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
Define the term Web Garden?
What is session in asp.net?
How is application management and maintenance improved in asp.net 2.0?
How can we update records in gridview?Is there any appropriate code for it?
Which is faster union or union all?
Describe the method to create a permanent cookie?
Who can consume WebAPI?
Explain the difference between Web Garden and Web Farm?
What is session object? Describe in detail.
What are the properties of the eventargs argument when capturing keyboard events?
What are the asp.net server side objects?
What is ispostback property?
Why do we use sessions?
How to add DateTime Control in normal DataGrid Server Control?
How to rename a table using sql queries?