.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Post New Resource Bookmark and Share   

Enumeration in C#.net

Posted By:Narayanan       Posted Date: September 26, 2011    Points: 40    Category:    URL: http://www.dotnetspark.com  

Here ,we discussed about Create and use of Enumeration in C#.net
 

Enumeration

      It is a Symbols that have fixed values.

      List of choice for Developers using your class

 Example:

Public   enum Gender

{

Male

Female

}

 

Public string Name;

Public int age;

Public Gender Gen;

Public person_Details (string _Name, int _age, Gender _Gen)

{

Name = _Name;

age =_age;

Gen =_Gen;

}

 

Public override string ToString ()

{

Return Name +  "("+ gender + "), age" + age ;  

}

 

Static void Main (string [] Arugs)

{

Person_Details persn = new Person_Details ("Narayanan", 28, Person_details.Gender.Male);

Console.WriteLine (persn.ToString);

}

 


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend