What is advisable to use dictionary or list?
What is advisable to use dictionary or list?
List can have duplicate values and it for search using liner algorithm. Hence it is slow. But Dictionary is searching on Key basis so it fast to get the values. If you have unique keys for your objects, use Dictionary.It is more efficient to use dictionaries for the lookup of elements as it is faster than a list and takes less time to traverse.
It is advisable to use list as dictionary objects cannot be serialized.
Dictionary
Both are altogether a different structure. If you are looking for key,value pair then you need dictionary, else list is good to go. If question is with respect to performance, then searching is faster in dictionary