- Collections are classes that support gathering of data in an orderly manner.
- SortedList is a name/value pair collection.
- BitArray is compact collection of Boolean values
- HybirdDictionary collection uses ListDictionary for small group of items and migrates to Hashtable when data size becomes large.
- The process when ValueTypes are wrapped up in object type is called Boxing.
- The AddRange( ) method of ArrayList supports every object that has implemented ICollection interface.
- Add( ) and AddRange( ) methods add objects at the end of ArrayList. For adding items at specific positions, use Insert( )/InsertRange( ) methods.
- The Remove( ) method will search for a given object in ArrayList, if found, will delete it, and if not found, will return without throwing Exception.
- ArrayList supports indexers, so we can use them as arr[2] = "something";
- For details on IEnumerator and how to use it, refer to MS Press book, Table 4-2 onwards.
- An alternative to using IEnumerable properties is to use the foreach construct.
- foreach may be used on any collection that supports IEnumerable.
- If we know the data type of the items in a specific collection, we may specify that in the foreach loop and it will automatically handle Unboxing.
- ICollection interface derives from IEnumerable interface. For details refer to MS Press book, Table 4-4 onwards.
- The CopyTo( ) method of the ICollection ensures that the contents of the collection can be converted into an Array.
- Simple collections such as ArrayList inherit from IList which in turn derives from ICollection. This adds the capability of methods such as Add( ), Clear( ), Contains( ), etc. and properties such as Item.
- The Sort( ) method in ArrayList uses Comparer class (which implements ICompaarer). So it also allows us to supply a Comparer object incase we dont wish to use the default.
Saturday, June 13, 2009
Chapter 4-Lesson 1
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment