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

hi wrever i go thy r asking depth abt 3-tier architecture i.e, hw to deploy 3 layers into 3 servers i do nt have much idea on deployment. can any one send me the tips or code if u hav kindly mail me.

1 Answers   Wipro,


what is view state

5 Answers   Microsoft, Siebel Systems,


Take one textbox if I am inputting abc alphabet in capital letter or in small letter on the button click it will be bcd or if I enter 123 and it would be 234 like that in ASP.NET?

3 Answers   DNS,


What are the cookies types in asp.net?

0 Answers  


Difference Between GridView And DataList

2 Answers  






What r all the controls in ASP.NET ?

3 Answers  


what is the generics and where used generics in your project?

3 Answers   CTC,


How would ASP and ASP.NET applications run at the same time on the same server?

0 Answers   Satyam,


What is .net framework and what are the main components of it?

0 Answers  


How does u call and execute a sp in .net?

0 Answers  


How can we register exception filter from the action?

0 Answers  


Is overloading possible in web services?

3 Answers   Microsoft,


Categories