a "global variable" is really a variable you create to simply "hold some information" because your object model is weak, and you haven't found a "true purpose" for the variable to exist. Global variables are almost always a sign of a larger architectural deformity.
That might be true. But I don't know of any good example of any big and good program made without global variables, and certainly not used as little as above suggested. Scope is the actual key. You can say in a program with only one class that its parameters are not global vars. But they are.
Anyway...
I'm still grasping the concept of singleton and, as far as I can tell, they actually make no sense in C#. Also I get the feeling that when having a global state can't be avoided we still should avoid simply using a public class full of static properties:
So, if not singletons nor a public class, what should we do to have global vars in C#?
And when are we supposed to use them? Assuming they most likely can't be avoided. Ever.
And why should we avoid using a static class or static
in general? If that's indeed the case for C#.
In one sentence: What are the best practices on using global variables in Csharp?