Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.NET project properties namespaces vs Imports statement?

In a VB.NET project, what is the difference between importing a namespace in Project-Properties and using a Imports [NameSpace] statement at the start of a file?

like image 453
Paul Lassiter Avatar asked Oct 21 '25 17:10

Paul Lassiter


1 Answers

Imports in the project properties apply to all code files.

The Imports directive only applies to the class it is declared in.

From How to: Add or Remove Imported Namespaces (Visual Basic) on MSDN:

Imported namespaces are managed on the References page of the Project Designer. The imports you specify in this dialog box are passed directly to the compiler (/imports) and apply to all files in your project.

like image 61
Oded Avatar answered Oct 23 '25 08:10

Oded