Sunday 26 July 2015

What is an Enumeration in C#.Net

        It was a property for which we can fix the type of values which can be assign to you. this values has to be first stored under on enum which was a collection of values.

Syntax : 

      [<Modifier>] enum<name>{[List of values]};


Eg : 

public enum days {monday; tuesday................. friday;}


  • A property which is define by using the enum as a type was an enumerated property.
  • An Enum can be declared either under a class or under a namespace also.
  • As on Enum is also a type if cannot be consume directly . To consume if first we need to created a copy on it.
Eg : Days Weekday=0

            (or)
Days  weekdays = days.monday;

Enumerated Property : 
      
                Public Days Weekday
            {
                     get { return Weekday;}
                      set { Weekday = value;}
           }


No comments:

Post a Comment