---
title: "Difference between Dictionary and Hashtable in C#?"  
description: "Difference between Dictionary and Hashtable in C#?"  
author: "Ethan Karla"  
published: 2021-08-27  
canonical: https://answers.mindstick.com/qa/93938/difference-between-dictionary-and-hashtable-in-c-sharp  
category: "programming"  
tags: ["c#", "java", "pythons"]  
reading_time: 1 minute  

---

# Difference between Dictionary and Hashtable in C#?

[Difference](https://www.mindstick.com/blog/398/difference-between-object-type-and-var-type) between [Dictionary](https://www.mindstick.com/articles/1500/hashtable-and-dictionary-in-c-sharp) and [Hashtable in C#](https://www.mindstick.com/forum/33627/how-to-use-hashtable-in-c-sharp-dot-net)?

## Answers

### Answer by Ravi Vishwakarma

> **Difference between Hashtable and Dictionary**

\

| **Hashtable** | **Dictionary** |
| --- | --- |
| Hashtable is present in System.Collections namespace. | Dictionary is present in System.Collections.Generic namespace |
| Hashtable is the non-generic collection, it can store data in key, the value of any type of data | Dictionary is the generic collection, it can store data in key, value pair of a specific datatype |
| Hashtable is thread-safe | The only member is thread-safe |
| return null if the key is not present in hashtable | throw an exception if the key is not present |
| slower than Dictionary | faster than Hashtable |

\


---

Original Source: https://answers.mindstick.com/qa/93938/difference-between-dictionary-and-hashtable-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
