C# extern int ? How do I make a global var across classes and namespaces ?
- by dr d b karron
Dear C#'ers;
As an old C/C++ programmer, I want to keep a global int counter across
all of MY namespaces and classes.
Public static extern int EventCount;
Is not working; the VS2010 compiler won't let me have an extern int.
Even with a DLLImport.
[DllImport ( "SilverlightApplication37.dll" )]
public static extern int EventCount;
VS2010 complains
Error 1 The modifier 'extern' is not valid for this item
so how do i have a global int across all my code ?
Cheers!
dr.K