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
Which .NET framework supports Web API?
What is difference between session and cookies in asp net?
What is server side session management?
What is the function of new view engine in asp.net? : asp.net mvc
What is web api and why to use it?
Which method do you use to enforce garbage collection in .net?
How can we call webservices in Banking Applications? and where we are using it?
What is a session government?
What is the use of session?
What is difference between URL and URI?
How do I use response redirect?
How do you deploy your asp.net application?
Can anyone please tell me that the question posted on this website are Sufficient for the interview with 2+ year experience in .net
How does a content page different from a master page?
Explain the disadvantages of viewstate?