

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Questions & Answers
- What is the difference between Dictionary and HashTable in PowerShell?
- What is the difference between a python tuple and a dictionary?
- What is the difference between List and IList in 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 a list and an array in C#?
- Difference between Dictionary and Hashtable in C#
- Difference between HashTable and Dictionary in C#
- What is the difference between == and === in JavaScript?
- What is the difference between $ and @ in R?
- What is the difference between jQuery.prop() and jQuery.attr()?
- What is the difference between jQuery and JavaScript?
- What is the difference between jQuery.size() and jQuery.length?
- What is the difference between jQuery and AngularJS?
- What is the difference between jQuery.show() and jQuery.hide()?
Advertisements