Knowledge Management Banner

Knowledge Management Banner

C# : Dictionary & List : Part 28

What is dictionary ?

  • It is a collection of key value pair


When to use dictionary over list ?

  • Dictionary is to be used when collection are to be used for look ups
List collection class.

Contains function
  • Checks if item exists in the list, this method return true if the item exists else false, no condition can be given to check if contains

Exists function
  • Checks if the item exists in the list based  on the condition which can be given by lambda expressions, which returns true if exist and return false, if doesn't.

Find function
  • Searches the element that matches the condition by lambda expression & return  first matching item.


FindLast function
  • Searches the element that matches the condition by lambda expression & return  last matching item.

FindAll function
  • Searches the element that matches the condition by lambda expression & return  all matching item.

FindIndex function
  • returns index of first element that matches condition by lambda expression

FindLastIndex function
  • returns index of last element that matches condition by lambda expression



No comments

Powered by Blogger.