Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Is there any way, we could view complete definition for CollectionBase class in System.Collection namespace ? Even in msdn, I couldn't find the method definitions in CollectionBase class. Although, the web pages in msdn contains only the properties and method declarations, the definitions are not provided : msdn link.

My doubt was :-
CollectionBase class implements IList, ICollection and IEnumerable interfaces. To derive our own collections, we can use List, which gives us access to the items through an IList interface, and InnerList, which is the ArrayList object is used to store items. There is no trace of Add method in CollectionBase class, so how does List.Add(item) work ? Where has Add method been defined ? Add method can't be defined in interfaces and there is no trace of Add method in CollectionBase class..
Posted
Updated 12-Feb-18 9:06am

Um. I found it pretty easily: http://msdn.microsoft.com/en-us/library/system.collections.collectionbase.aspx[^]

And it lists the Add method under "Explicit Interface Implementations"

How did I find it?
I Googled for CollectionBase class[^] by highlighting it in your question and right clicking. Select "Search Google for..." and it was the top hit.

Perhaps your Google-fu needs a little improvement?
 
Share this answer
 
Comments
arunlakra15 6-Dec-12 12:25pm    
ah perhaps.. I'm new to this. So there must be an implementation for IList.Add method in CollectionBase class, right ? And If there is, can we view how it has been implemented ?
THE COLLECTIONBASE CLASS
The .NET Framework library does not include a generic Collection class
for storing data, but there is an abstract class you can use to build your
own Collection class—CollectionBase. The CollectionBase class provides the
programmer with the ability to implement a custom Collection class. The
class implicitly implements two interfaces necessary for building a Collection
class, ICollection and IEnumerable, leaving the programmer with having to
implement just those methods that are typically part of a Collection class.

From Book Titled: by M. McMillan
DATA STRUCTURES AND
ALGORITHMS USING C#
 
Share this answer
 
Comments
CHill60 12-Feb-18 17:37pm    
Adds nothing to the reference to the documentation posted over 5 years ago

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900