In C# what is the difference between public static void and static void and how come void can be exchanged to a reference?
2014-03-23T07:51:38Z
The wording wasn't right... I have seen public static Car instead of public static void, Car referring to a Car in the class I think...
husoski2014-03-23T07:41:36Z
Favorite Answer
The difference is "accessibility", which you might have seen called "visibility" in other languages.
"public static void" has public visibility--any code can use whatever is being defined.
"static void" has a default visibility that depends on where the definition occurs. In a class or struct, the default is "private".
As for "void can be exchanged to a reference", I'm afraid I don't have the pleasure of understanding you. The void type can't be applied to a variable declaration, as far as I know, except in unsafe mode to declare a pointer to an unknown type. There are no objects of type void, so a reference to void is not possible.