"using" alias in global scope

  • Thread starter Thread starter VRSki
  • Start date Start date
V

VRSki

Hello,

Is there any way to use "using" for aliasing in the global scope?

The example below works fine in the context of a given file, but in the
different file MyByte alias is unknown. Is there any way to extend its
visibility to multiple files without redefining it?

using MyByte=System.Byte;

namespace MyNamespace
{
public static void Foo()
{
MyByte b = 0;
}
}

Thanks,
VR
 
VRSki said:
Is there any way to use "using" for aliasing in the global scope?

The example below works fine in the context of a given file, but in the
different file MyByte alias is unknown. Is there any way to extend its
visibility to multiple files without redefining it?

No - a using directive only ever applies to the file it occurs in.
 
Hi VR,

As for the using directive, as Jon has mentioned, it is limited to the file
where it is declared. The MSDN reference on using directive also ponit out
the scope of using:

#using Directive (C# Reference)
http://msdn2.microsoft.com/en-us/library/sf0df423(VS.80).aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
 
Hi VR,

Have you any other questions on this? If so, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 
Back
Top