Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# collections
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 6-Dec-12 7:05am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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?
  Permalink  
Comments
arunlakra15 at 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 ?

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



Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 6 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100