Allow using up to the object level.

Darren sent me a few questions. Normally, I'd put these in the C# FAQ, but I've decided to answer them here for now. They may migrate to the FAQ in time.

 

*** allow "using" up to the object level

I use VB sometimes, and one of the things I really love about it is that if I create a static class (say CommonFunctions) I can import SMB.Common.CommonFunctions. All static functions are now part of just my standard namespace. I like it! Object purists may have collective apoplexy, but I'd prefer to remain agnostic and believe that we shouldn't have to qualify absolutely everything we do. Some functions really do belong in the global namespace (and all languages have some) - and it would be really nice as a developer to be able to make our own. It's there in VB - can we have it in C#? Please? :)

I think it's unlikely that we will do this. I understand the desire to be able to do this, but one of our major goals is to keep the language readable. Features like this and C++'s macros mean that to read code, you don't just have to understand the base language, you also have to understand all the additions that have been added by the author of the current project.

 

So, yes, it is true that writing Math.Sin() is longer than just writing Sin(), but it's also much clearer to any reader of the code.