what is ienumerable interface?



what is ienumerable interface?..

Answer / bipin

The IEnumerator interface provides iterative capability for
a collection that is internal to a class.
IEnumerator requires that you implement three methods:

The MoveNext method, which increments the collection
index by 1 and returns a bool that indicates whether the
end of the collection has been reached.

The Reset method, which resets the collection index to
its initial value of -1. This invalidates the enumerator.

The Current method, which returns the current object at
[position].

public bool MoveNext()
{
position++;
return (position < carlist.Length);
}

public void Reset()
{position = 0;}

public object Current
{
get { return carlist[position];}
}

IEnumerable interface
The IEnumerable interface provides support for the foreach
iteration. IEnumerable requires that you implement the
GetEnumerator method.

public IEnumerator GetEnumerator()
{
return (IEnumerator)this;
}

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

Is It Possible for Static Variables access normal variable? and Normal Varialbe Access the static Variables?

1 Answers   Phoenix Technologies,


In a Repeater control how one can provide an alternating color scheme ?

0 Answers   Siebel,


Any body Having SHAREPOINT Material plzzz? please material to send prasad.k12@gmail.com

0 Answers  


To which class you load XML or Related Data

1 Answers  


What is Partial PostBack in ASP.NET?

0 Answers   Viscus Infotech,






Write some code using interfaces, virtual methods, and an abstract class`

0 Answers  


What is application session?

0 Answers  


How can u debug your .net application?

0 Answers  


code for "For every 5days system has to create 1text file with the corresponding date and it has to store in c-drive" by using web applications

0 Answers  


Explain the differences between Server-side and Client-side code?

2 Answers  


What is the difference between Server.Transfer and Response.Redirect? Why would you choose one over the other?

26 Answers   Syntax Softtech,


What is anonymous authentication?

0 Answers  


Categories