#285 – Class Member Overview

A class in C# can contain the following types of members:

Member Type Description Private / Public Instance / Static
Constants Constant values x
Fields Variables that can be read/written x x
Methods Procedure that can be called to perform some logic x x
Properties Data storage item that can have associated get/set behavior x x
Indexers Allows an instance of class to be indexed like an array x
Events Allows the class to notify client code when some condition occurs x x
Operators Defines behavior for class when instances are used within expressions using standard operators public static
Constructors Method that is called when an instance of the class is created x x
Destructors Method that is automatically called by the garbage collector before an object’s memory is released

Types Nested type declared inside the class x
x
Advertisements