By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,889 Members | 1,297 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,889 IT Pros & Developers. It's quick & easy.

What is the relationships between IList, Collection and Array

P: n/a
ad
Hi,
When I studied CSharp, I am confuse by IList, Collection and Array.
What is the relationships between them?
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
IList is an interface. It provides a template, i.e. a common set of
properties and methods that every kind of list should implement. Any class
implementing IList must provide definitions for the members of this
interface. This guarantees that all classes that implement this interface
offer a basic set of common functionality. If you take a look at the
interface definition you will notice that IList implements two other
interfaces itself, namely ICollection and IEnumerable. This makes sense as a
list is basically an enumerable collection.

A collection is a term for a particular *kind* of class. The characteristics
that a collection should exhibit are defined in ICollection, and any data
structure implementing this interface is a collection. Simply think of a
collection as just that: a collection of objects (or simple data types, of
course).

An array *is* a collection. It shares some common features with all other
collections. However, it can be distinguished from other collections by its
specific functionality (e.g. it has a fixed size, it contains data of only
one type, etc.)

I hope this makes sense.
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eg**************@TK2MSFTNGP15.phx.gbl...
Hi,
When I studied CSharp, I am confuse by IList, Collection and Array.
What is the relationships between them?

Nov 17 '05 #2

P: n/a
Kai... A very thoughtful response, but I must admit that I cringe a
little bit when you describe an interface as a template. Another option
would be to describe an interface as a contract :) :) :).

http://www.geocities.com/jeff_louie/OOP/oop9.htm

When I see the word template in C# I think generics.

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3

P: n/a
ad
Thank very much!

"Kai Brinkmann [MSFT]" <ka******@online.microsoft.com> glsD:uD**************@tk2msftngp13.phx.g bl...
IList is an interface. It provides a template, i.e. a common set of
properties and methods that every kind of list should implement. Any class
implementing IList must provide definitions for the members of this
interface. This guarantees that all classes that implement this interface
offer a basic set of common functionality. If you take a look at the
interface definition you will notice that IList implements two other
interfaces itself, namely ICollection and IEnumerable. This makes sense as
a list is basically an enumerable collection.

A collection is a term for a particular *kind* of class. The
characteristics that a collection should exhibit are defined in
ICollection, and any data structure implementing this interface is a
collection. Simply think of a collection as just that: a collection of
objects (or simple data types, of course).

An array *is* a collection. It shares some common features with all other
collections. However, it can be distinguished from other collections by
its specific functionality (e.g. it has a fixed size, it contains data of
only one type, etc.)

I hope this makes sense.
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no
rights.

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eg**************@TK2MSFTNGP15.phx.gbl...
Hi,
When I studied CSharp, I am confuse by IList, Collection and Array.
What is the relationships between them?


Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.