To nije moguce uraditi jer u C# sve mora da bude u klasama, nikakva globalna promenljiva ili funkcija ne sme da postoji. Taj problem mozes da resis tako sto ces napraviti jednu staticku klasu koja ce da ima sve promenljive koje hoces da budu globalne koje takodje oznacis kao staticke. Takve klase ne mogu da se instanciraju i sluze samo da koristis njihove staticke metode i promenljive (iz drugih klasa ili nasledjenih)
Citat:
Static classes and class members are used to create data and functions that can be accessed without creating an instance of the class. Static class members can be used to separate data and behavior that is independent of any object identity: the data and functions do not change regardless of what happens to the object. Static classes can be used when there is no data or behavior in the class that depends on object identity.
Npr
Code:
static class Employee
{
public static string id;
public static string name;
}
-I know UNIX, PASCAL, C, FORTRAN,
COBOL, and nineteen other high-tech
words.