×

C# Tutorial

Basics of .Net

C# Basics

C# Fundamentals

C# Operators

C# Loops

C# Type Conversions

C# Exception Handling

C# String Class

C# Arrays

C# List

C# Stack

C# Queue

C# Collections

C# Character Class

C# Class and Object

C# Namespaces

C# Delegates

C# Constructors

C# Inheritance

C# Operator Overloading

C# Structures

C# File Handling

C# Convert.ToInt32()

C# Int32 (int) Struct

C# DateTime Class

C# Uri Class

C# Database Connectivity

C# Windows

C# Other Topics

C# Q & A

C# Programs

C# Find O/P

Why is Dictionary preferred over Hashtable in C#?

Here, we are going to learn why is Dictionary preferred over Hashtable in C#.Net?
Submitted by Nidhi, on January 13, 2021

The Dictionary and Hashtable, both are collections in the .NET framework. The Dictionary is the generic collection, whereas Hashtable is a non-generic collection. It is very interesting that in the .Net framework Dictionary is implemented using Hashtable.

The Dictionary is preferred over HashTable because of type-safety and it maintains the order of stored values. We cannot insert the random object into the dictionary. Both Dictionary and Hashtable are used key/value pairs to store the data elements.

Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.