how to use Enumerator...

Posted by Gopal_nivas under C# on 11/24/2009 | Views : 1442 | Status : [Member] | Replies : 3
hi..

what is enumerator and what is purpose of using enumerator..

give some brief examples..

need ur suggestions..

regards
gopal.s




Responses

Posted by: Vuyiswamb on: 11/24/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
This will help

http://msdn.microsoft.com/en-us/library/sbbt4032%28VS.80%29.aspx

http://www.winnershtriangle.com/w/CSharpHelp_Enumerators.asp

Thank you for posting at Dotnetfunda

Vuyiswa Maseko


Thank you for posting at Dotnetfunda
[Administrator]

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhijit Jana on: 11/25/2009 [Member] [MVP] Bronze

Up
0
Down
Here is one good link for start with :
http://www.c-sharpcorner.com/UploadFile/prasadh/Enumerators11132005232321PM/Enumerators.aspx

Cheers !
Abhijit

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Saranram on: 11/26/2009 [Member] Starter

Up
0
Down
Enumeration:
You can create your own set of named constants by using enumerations. In enumeration can be defined by using the enum keyword.

The default underlying type of the enumeration elements is int. By default, the first enumerator has the value 0, and the value of each successive enumerator is increased by 1.

Ex:

using System;
public class EnumSamp
{
enum Days {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri};

static void Main()
{
int a = (int)Days.Sun;
int b = (int)Days.Fri;
Console.WriteLine("Mon = {0}", a);
Console.WriteLine("Wed= {0}", b);
}
}




Saran

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response