Paul Lassiter
Paul Lassiter

Reputation: 2771

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?

Upvotes: 4

Views: 3315

Answers (1)

Oded
Oded

Reputation: 499382

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.

Upvotes: 8

Related Questions