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 State management in asp.net
How does session work in asp net?
What is session start?
What is the purpose of asp.net?
Explain the asp.net mvc folder conventions? : asp.net mvc
Describe paging in asp.net?
What is global.asax file used for?
What is a SESSION and APPLICATION object?
What are Master Pages in ASP.NET?
What is page fragment caching?
What is the server of asp.net?
Which methods validate all the controls on a page?
Tell me the code snippet to show how we can return 404 errors from HttpError?
What is asp according to you?
What is the Difference between MVC And MVP design pattrens