Defining a Class in C# - dummies

By Bill Sempf, Charles Sphar, Stephen R. Davis

Part of C# 2010 All-In-One For Dummies Cheat Sheet

In C#, as in most object-oriented programming languages, a class is a bundling of unlike data and functions that logically belong together into one tidy package. Good classes are designed to represent concepts. Classes are central to C# programming. In broad terms, here is how you define a class in C#:

 [access][<abstract | sealed>]class MyClassName [: [BaseClass] [, Interface, ...]]
  [static][access]type dataMember;
  [<static|virtual|abstract|new|override>][access]type method(. . . args . . .)
for classes, access is public|protected|internal|private
  for class members, access can also be protected internal


[feature] feature is optional
<feature1 | feature2> Either feature1 or else feature2
. . . Unspecified number of statements or expressions