• Feeds

    Subscribe in a reader

  • Ads

RootNamespace in VB.NET

I confess,I don’t do a ton of VB.NET coding. Check that – I don’t doany VB.NET coding. I’m strictly a curly-braces-and-semicolons kind ofguy. However, I’m finding myself responsible for a code generator thatneeds to be bi-lingual between C# and VB.NET. As a result, I’m sort offorced to code VB by proxy…

Anyway, I wanted to toss out a question to the more VB-minded readers of thisblog: what are the best practices around setting the RootNamespace property inthe project options? On large projects, do you set this to something and omitnamespace declarations from the class files, or do you leave it blank anddeclare namespace membership explicitly, a la C#?

Personally, the whole RootNamespace feels like pure evil to my C# mind. Thethought that my class might actually not be in the namespace it declares seemsnefarious at best. I can see how this would be a valuable feature to a VB6developer who might be namespace-phobic, but I’m curious how this featuregets used on enterprise-level projects.

 

#1 Mats Helander on 8.14.2004 at 5:06 PM

Hi Steve!I develop in both C# and VB.NET. Since I do both, I try to develop in a way that allows me to do things in a similar fashion when I'm in either language.The RootNamespace thing is a good example of that. Thus, I don't use it (except sometimes when I'm lazy, and then it usually comes back to bite me!), declaring the namespaces in the code just as I do in C#.Also, if you compile from the command-line, you don't have to throw in the extra parameter specifying the RootNamespace if the namespaces are declared in the code!Great Blog, btw! :-)/Mats Helander

#2 Steve on 8.16.2004 at 12:40 AM

I'll take the implication that since your mum is not "VB-minded", she is surely the secret C# genius behind your blog and Avanade community posts.