Collection Defination
-
While going through collectios i came across a sentence which says.."An object is called collection if it is able to supply a reference to related object called IEnumerator"..can u please explain me what this sentence actually means..I have an idea of Interfaces.
-
While going through collectios i came across a sentence which says.."An object is called collection if it is able to supply a reference to related object called IEnumerator"..can u please explain me what this sentence actually means..I have an idea of Interfaces.
Rahul83 wrote:
I have an idea of Interfaces
Then you'd better find out what an interface is.
-
While going through collectios i came across a sentence which says.."An object is called collection if it is able to supply a reference to related object called IEnumerator"..can u please explain me what this sentence actually means..I have an idea of Interfaces.
Rahul83 wrote:
While going through collectios i came across a sentence which says.."An object is called collection if it is able to supply a reference to related object called IEnumerator"..can u please explain me what this sentence actually means
The sentence is incorrect in part. The sentence would read better as: An
object
can be called a collection if it is able to supply a reference to a relatedobject
that implementsIEnumerator
. Theobject
calling itself a collection must also implement theIEnumerable
interface. TheIEnumerable
interface sets up a contract that theobject
must have a method calledGetEnumerator()
which returns anobject
that implementsIEnumerator
IEnumerator
is used internally with in aforeach
loop to get at all the elements in a collection. This is still not the full story, but it does go some way to explaining what that sentence means.
Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
Rahul83 wrote:
While going through collectios i came across a sentence which says.."An object is called collection if it is able to supply a reference to related object called IEnumerator"..can u please explain me what this sentence actually means
The sentence is incorrect in part. The sentence would read better as: An
object
can be called a collection if it is able to supply a reference to a relatedobject
that implementsIEnumerator
. Theobject
calling itself a collection must also implement theIEnumerable
interface. TheIEnumerable
interface sets up a contract that theobject
must have a method calledGetEnumerator()
which returns anobject
that implementsIEnumerator
IEnumerator
is used internally with in aforeach
loop to get at all the elements in a collection. This is still not the full story, but it does go some way to explaining what that sentence means.
Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website