Enumerations:
An enumeration is a user - defined integer type. When you declare an enumeration, you specify a set of acceptable values that instances of that enumeration can contain. Not only that, but you can give the values user - friendly names.
color skyblue = color.blue;
int code = (int) Enum.Parse(typeof(color),skyblue.ToString());
if (code == 101010)
{
Console.WriteLine("The color you have chosen is "+skyblue+" and the color code is "+ code.ToString());
Console.ReadKey();
}
}
public enum color
{
blue = 101010,
black = 000000,
white = 111111
}
Regards
Sameer Shaik
Tags: Microsoft MCTS exam, Learn, Tutorials, Free C#, Free Videos, Microsoft Dot Net Jobs,Microsoft Dot Net Jobs Interview, Free Training and Preparation, Jobs MCTS specialization, visual studio.net, study guide, sample questions, Exam Prep, Exam Practice Test
No comments:
Post a Comment