Add



Structure and Enum

Structure

In C#, structure is defined using struct keyword. Note that struct is of value-type. Like class, Struct is also inherited from System.Object. Value types are stored in stack. For example,

    struct CustomerData
    {
        ...
    }

In structure, we can implement interface. Struct has constructor. We can also write properties and methods in it. Note that Inheritance and Polymorphism cannot be applied in Struct. For method overriding (Runtime Polymorphism), Inheritance is must. If there is no inheritance then there is no method overriding.

Enum

Enum is a user defined data type. Enum is of value-type. For example,

    enum Category
    {
	    Electronics,
	    Furnitures,
	    Grocery
    }