Generally speaking, a common VB.NET class should look like the following:
Public Class MyClassName
End Class
Besides, I have already seen, if I remember correctly, all of the import statements visible just like in C#:
Imports System
Imports System.Data
Imports System.Linq
Public Class MyClassName
End Class
How to make these default imports visible by default in VB.NET using Visual Studio 2008?
Is there some setting or the like in the options I shall set?
Thanks! =)
Good question. The VB.NET Language spec only mentions "implicit imports" without giving an authoritative list. I can reverse-engineer it from the command line as shown in the output window, VS2008 and VS2010 uses this /Imports command line option:
MSBuild sets these in Microsoft.VisualBasic.targets from the Import variable. Which is set in the .vbproj file:
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
</ItemGroup>
Altering the Project + Reference setting does alter this list but there's no obvious one-to-one correspondence since this screen changes assembly references, the <Import>
build variable lists name spaces. I'll have to punt, this ultimately is determined by the project template.
Right click on the project in Visual Studio then go to Properties. On the "References" tab there is a list of imported namespaces at the bottom. Anything added there doesn't need to be imported for any file in the project.
So to see the ones that are defaulting, you can just look there. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With