Creating Static MembersSo far, the fields, methods, and properties we've been creating have all been members of objects. You can also create fields, methods , and properties that you use with classes directly, not with objects. These members are called static members , also called class members (not object members), and you use them with the class name, not the name of an object. As you know, Main is declared static so that C# itself can call it without creating an object from your main class. That's the way it works with all static membersthey're intended to be used with the class, not with an object. We'll take a look at creating static members now, starting with static fields.
|