Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c# - Use alias in another file

Tags:

namespaces

c#

Is it possible to use an alias defined in one file throughout an assembly?

For eg. in Foo.cs I have

using IO = System.IO;
namespace Foo
{}

How can I use the alias "IO" in FooBar.cs

namespace Foo.Bar
{}
like image 921
Krishter Avatar asked Jan 04 '12 06:01

Krishter


1 Answers

According to MSDN

The scope of a using directive is limited to the file in which it appears.

So the answer is No. You cannot define an alias in one file and use it throughout assembly

like image 123
Haris Hasan Avatar answered Sep 22 '22 23:09

Haris Hasan