Answer Posted / 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 View All Answers
Explain server control extensibility with reference to asp.net 2.0 ?
What is the meaning of TestApi?
To bind columns manually which tags do you need to add within the asp:datagrid ?
Why asp.net is better than php?
What is is post back property in asp net?
What is a user developed application?
What are the new features implemented in ASP.NET?
What are the data controls available in asp.net?
How to disable disable browser's Back button in asp.net (JavaScript)?
Is session stored in browser?
How does viewstate work?
If you have an application with multiple security levels though secure login and my ASP.NET web appplication is spanned across three web-servers by using round-robbin load balancing. Explain which is the best approach to maintain login-in state for the users?
What does mean by a neutral culture?
Why will you usually create an aspnet user account in the database for an asp.net web application?
We Only Know The Total Number Of Feet In The Farmyard. Write A Program that will compute the total number of rabbits and chickens in the farmyard. Assume number of feet in the farmyard are 40. how many rabbits and chickens are?