Global Import/using Aliasing in .NET

Posted by Josh Stodola on Stack Overflow See other posts from Stack Overflow or by Josh Stodola
Published on 2010-03-19T20:10:00Z Indexed on 2010/03/19 20:21 UTC
Read the original article Hit count: 166

Filed under:
|
|
|
|

Using import aliasing in a single class, we can reference class library namespaces by assigning our own custom alias like this:

' VB
Imports Db = Company.Lib.Data.Objects 

// C#
using Db = Company.Lib.Data.Objects;

And then we are able to reference the classes inside of Company.Lib.Data.Objects by using the Db alias that we assigned.

Is it possible to do this at the global level so that the alias is applied to the entire solution instead of the given file?

Currently, we are working with web applications, so I was hoping we could add something to web.config, but I am also interested in whether or not this is possible with windows forms, console apps, and/or class libraries.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about global