-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Anand_2004
Message 1 in Discussion

   
Hi Folks, 
Today I am covering  part Two of my article on Generics. Now I am talking about 
how generic type instantiate and generic classes in the base class library 2.0 
Generic Type Instantiation  
Similar to non-generic type the IL code maintain special instruction for 
generic type .The first time an application creates an instance of a 
constructed generic type, such as myList<int>, the just-in-time (JIT) compiler 
of the .NET Common Language Runtime converts the generic IL and metadata to 
native code, substituting actual types for type parameters in the process. 
Subsequent references to that constructed generic type then use the same native 
code. The process of creating a specific constructed type from a generic type 
is known as a generic type instantiation and one important thing is The .NET 
Common Language Runtime creates a specialized copy of the native code for each 
generic type instantiation with a value type, but shares a single copy of the 
native code for all reference types because at the native code level, 
references are just pointers with the same representation. 
Generic classes  in  Base Class Library 2.0 
Version 2.0 of the .NET Framework base class library provides a new namespace, 
System.Collections.Generic, which includes several ready-to-use generic 
collection classes and associated interfaces. These classes and interfaces are 
more efficient and type-safe than the non-generic collection classes provided 
in earlier releases of the .NET Framework. Before designing and implementing 
your own custom collection classes, consider whether you can use or derive a 
class from one of the classes listed  as below 
Collection<T> / ICollection<T> : Provides the base class for a generic 
collection and the correspondence non generics type is  CollectionBase/ 
ICollection 
Comparer<T>/ IComparer<T>/ IComparable<T> : Compares two objects of the same 
generic type for equivalence and for sorting and the correspondence non 
generics type is Comparer/IComparer/IComparable 
Dictionary<K, V>/IDictionary<K,V> : Represents a collection of key/value pairs 
that are organized based on the key and the correspondence non generics type is 
Hashtable/IDictionary 
Dictionary<K, V>.KeyCollection : Represents the collection of keys in a 
Dictionary<K, V>. 
Dictionary<K, V>.ValueCollection : Represents the collection of values in a 
Dictionary<K, V>. 
IEnumerable<T>/IEnumerator<T> : Represents a collection that can be iterated 
using foreach and the correspondence non generics type is 
IEnumerable/IEnumerator 
KeyedCollection<T, U> : Represents a keyed collection. and the correspondence 
non generics type is KeyedCollection 
LinkedList<T> :  Represents a doubly linked list  
LinkedListNode<T> : Represents a node in a LinkedList<T> 
List<T><O:P> </O:P>/IList<T><O:P> </O:P>: Implements the IList<T> interface 
using an array whose size is dynamically increased as required and the 
correspondence non generics type is ArrayList<O:P> </O:P>/IList 
Queue<T> : Represents a first-in, first-out collection of objects and the 
correspondence non generics type is Queue 
ReadOnlyCollection<T> : Provides the base class for a generic read-only 
collection and the correspondence non generics type is ReadOnlyCollectionBase 
SortedDictionary<K, V> : Represents a collection of key/value pairs that are 
sorted by key based on the associated IComparer<T> implementation and the 
correspondence non generics type is SortedList 
Stack<T> : Represents a simple last-in-first-out (LIFO) collection of objects  
and the correspondence non generics type is Stack 
 Note 
:Dictionary<K,V>.KeyCollection,Dictionary<K,V>.ValueCollection,LinkedList<T>,LinkedListNode<T>
 does not has correspondence non generics type. The new generic class is 
slightly different from, and not fully compatible with, that of the non-generic 
class they replace. 
Cheers 
Anand 
http://spaces.msn.com/members/anandkumar

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to