Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
general knowledge
 ASP.NET
 :) Hot Jobs
 
 :) Latest Articles


  

 
CreamKids


Hashtable vs Dictionary in csharp?
Question Posted on 26 Apr 2022

Home >> DotNet >> C# >> Hashtable vs Dictionary in csharp?




Hashtable vs Dictionary in csharp?
Below are the some of the common difference between Hashtable and Dictionary:-
0
0

Base of DifferenceDictionaryHashtable
TypeDictionary is basically a generic type Dictionary <TKey,TValue>Hashtable is basically a non-generic type.
Boxing and UnboxingIn Dictionary we donot have need of boxing and unboxing.Values in hashtable need both boxing and unboxing.
Weak StrongDictionary class is strong type so you must specify the data types for key and value (<TKey,TValue>).Hashtable is basically a weak type data structure so we can add keys and values of any of object type.
Non-Existing keyIn Dictionary when we try to access non existing key dictionary we will get runtime error.But when we try to access non existing key hashtable it will produce null values.
Order of ValuesDictionary maintains an order of stored values.On the other hand Hashtable never maintains an order of stored values.
SpeedAs there is no need of boxing and unboxing it is faster than hashtable. Hashtable needs boxing and unboxing so it is slower tahn Dictionary.


 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


Other Important Questions
Simplest definition of partial classes and its rules?
Definition of Tuple class with some examples?
Define Race Condition in cSharp?
C#.Net Reserve Words
can we inherit private class level variables in c#






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |