How to add namespaces automatically in Visual Basic?

6

When creating any class in C #, using Visual Studio, it automatically adds the namespace, as can be seen below:

namespace Aplicacao.Modelo
{
    class Cliente
    {
    }
}

In Visual Basic, it does not do the same thing:

Public Class Cliente    
End Class

The result I was hoping for was:

Namespace Aplicacao.Modelo    
    Public Class Cliente 
    End Class    
End Namespace

Is there any way to make VS do the same for VB?

    
asked by anonymous 27.12.2016 / 00:30

1 answer

6

You should look at these two paths:

\*VisualStudioInstallationDirectory*\Common7\IDE\ItemTemplates\*Language*\Code\*Locale*\

\*VisualStudioInstallationDirectory*\Common7\IDE\ProjectTemplates\*Language*\Code\*Locale*\

What is in between asterisks is variable. Obviously you need to look at the location where your VS was installed (the version will vary there as well). Language is the language of the template , in general it will be CSharp or VisualBasic , which is what you want. The Locale is a code according to the (spoken) language used, usually it is 1033 .

It's all there that the VS takes to start something ready. Edit as you want, within the format. You have to learn the template variables. It can look like it's in C # to copy to VB.Net.

    
27.12.2016 / 01:01