Hi Please some1 explain me Enum

csharp Oslo, Norway
  • 12 years ago

    Hi all, Please some one explain Enumerators in C#, its uses, with some simple sample code

  • 12 years ago

    You first need to decide what it is you want to know about.  The title says one thing and the post says another.  An enumerated type is a completely different thing to a list enumerator. 

  • 12 years ago

    Hi,

    Thanks for the reply, sorry for the original post, all i want to know is list enumerator, how to use it, and its advantages. It will be good for me if you help me on  this.

       

  • 12 years ago

    An enumerator is an object that implements the IEnumerator interface.  The IEnumerator interface has three members:

    MoveNext: moves to the next item in the list being enumerated.

    Current: returns the current item in the list.

    Reset: moves back to the beginning of the list.

    You should very rarely  have to deal with enumerators directly.  As has been shown, the way to enumerate a list is with a foreach loop, which provides native language support for the IEnumerable/IEnumerator interfaces.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The question of whether computers can think is just like the question of whether submarines can swim.” - Edsger W. Dijkstra