- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between list and dictionary in C#?
Dictionary is a collection of keys and values in C#. Dictionary<TKey, TValue> is included in the System.Collection.Generics namespace. Dictionary is a generic type and returns an error if you try to find a key which is not there.
List collection is a generic class and can store any data types to create a list.
A list is a group of items −
List<string> myList = new List<string>() { "Maths", "English", " Science" };
Dictionary is a set of key-value pairs.
Dictionary<string, int> d = new Dictionary<string, int>(); d.Add("squash", 1); d.Add("football", 2); d.Add("rugby", 3);
Looping is easier and faster in a list and access element using index easily with a List.
- Related Articles
- What is the difference between Dictionary and HashTable in PowerShell?
- What is the difference between List and IList in C#?
- Difference between Dictionary and Hashtable in C#
- Difference between HashTable and Dictionary in C#
- What is the difference between a list and an array in C#?
- What is the difference between a python tuple and a dictionary?
- What is the difference Between C and C++?
- What is the difference between a python list and a tuple?
- What is the difference between a python list and an array?
- What is the difference between | and || operators in c#?
- What is the difference between JavaScript and C++?
- What is the difference between "std::endl" and " " in C++?
- What is the difference between overriding and shadowing in C#?
- What is the difference between String and string in C#?
- What is the difference between literal and constant in C#?

Advertisements