Class Members

Classes are essentially object definitions, providing applicable information on the data and behavior of the objects you declare and instantiate in your programs. Classes should be self-contained with a single purpose in mind. All included members should be compatible and interact effectively to support that purpose.

Remember how objects were described in the last chapter: they have attributes and behavior that define what they are. Classes define objects; they tell what attributes and behaviors an object will have. Here's a simple class skeleton:

class WebSite
{
       // constructors

       // destructors

       // fields

       // methods

       // properties

       // indexers

       // events

       // delegates

       // enumerations

       // classes
}

In this example, the class key word ...

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.