Nhan,
You can declare a variable as static. Once you do that, depending on
the accessibility level, you can access it everywhere. If you declare it as
public static, then any assembly referencing your assembly can see the
field. If it is internal static, then only types in your assembly can
reference it. If it is protected static, then only your type, and any type
deriving from your type can access it.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Le said:
Hi,
How can I define a global variable in .NET? I mean, everywhere in the same
project can access this variable.
Thanks
Nhan