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

What is the difference between debug and release?

0 Answers  


What are validator? Name the validation controls in asp.net? How do you disable them?

0 Answers  


How can we update records in gridview?Is there any appropriate code for it?

0 Answers  


Is post back in asp.net?

0 Answers  


What is ascx?

0 Answers  


Explain the overview of asp.net?

0 Answers  


what is the cursor

1 Answers   Wipro,


What is rich control in asp.net?

0 Answers  


How can we create custom controls in asp net?

0 Answers  


Why does a user need nothing more than a Web browser to view ASP.NET pages?

1 Answers  


What is role manager work in web.config? how to restrict perticular pages from the users using the role manager?

1 Answers   Infosys,


can we remote debug applications with the remote debugger installed with vs.net 2002, with vs.net 2003?

0 Answers  


Categories