Hashtable
It returns null if we try to find a key which does not exist.
it is a non generic collection
it is present in System.Collections name space
In hashtable the value store in key value pair
It is slower than dictionary because it requires boxing and unboxing.
example
Hashtable hashtable = new Hashtable();
hashtable.Add("Area", 1000);
hashtable.Add("Perimeter", 55);
hashtable.Add("Mortgage", 540);
Dictionary
It returns error if we try to find a key which does not exist.
it is a generic collection
it is present in System.Collections.Generic name space
In Dictionary the value store in key value pair
It is faster than a Hashtable because there is no boxing and unboxing.
example
Dictionary<int,string> d = new Dictionary<int,string>();
d.add(1,'siv);
d.add(2,'sankar');
It returns null if we try to find a key which does not exist.
it is a non generic collection
it is present in System.Collections name space
In hashtable the value store in key value pair
It is slower than dictionary because it requires boxing and unboxing.
example
Hashtable hashtable = new Hashtable();
hashtable.Add("Area", 1000);
hashtable.Add("Perimeter", 55);
hashtable.Add("Mortgage", 540);
Dictionary
It returns error if we try to find a key which does not exist.
it is a generic collection
it is present in System.Collections.Generic name space
In Dictionary the value store in key value pair
It is faster than a Hashtable because there is no boxing and unboxing.
example
Dictionary<int,string> d = new Dictionary<int,string>();
d.add(1,'siv);
d.add(2,'sankar');
No comments:
Post a Comment