Friday, October 17, 2008

Enumerations in C#.Net

Enumerations in C#.Net

An enum is a value type with a set of related named constants often referred to as an enumerator list.

Here I am using the Build in Enum type named DbType, which returns all the types.

Get value of particular index

DbType value = (DbType)10;

The Result will be Int16

Get index of particular value,

int index = (int)DbType.Int16;


The Result will be 10

No comments: