Thursday, June 19, 2003

Excellent VS.NET feature request list posted in the letters section of Visual Studio magazine. The writer's name is Jim Pragit. #2 in his C# wish list is for a "shortcut syntax so you don't have to specify SomeNamespace.SomeClass twice, as in this code:

SomeNameSpace.SomeClass myObject = new SomeNameSpace.Someclass;   "

In my own code, I have something like this:

localhost.RandomNumber RN = new localhost.RandomNumber();

This looks pretty benign but when you start to have web services posted other than on your test machine, the namespaces can get quite long. Also never mind the conceptual problem. If SomeNameSpace.SomeClass is a valid object type, like int or string, then you ought to treat it that way. The compiler already knows who SomeNameSpace.SomeClass is, so the extra mention doesn't give any more information. It's like saying:

ThreeStooges objLarry = new ThreeStooges();

We already know all about what kind of object to create from the left hand side of the equals.


comment []8:25:33 PM