Dictionary in C sharp. Please explain with code

What is dictionary in C#.Please explain.

The Dictionary type in the C# language provides fast lookups with keys to get values.
It allows you to use keys and values of any type, including ints and strings.
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        Dictionary <string, int> dictionary = new Dictionary<string, int>();
dictionary.Add("cat", 2);
dictionary.Add("dog", 1);
dictionary.Add("llama", 0);
dictionary.Add("iguana", -1);
dictionary.Add("iguana", -1);
    }
}

Comments

Popular posts from this blog

CAML Query in SharePoint 2010

Calling REST APi from server side code - C#

All about SharePoint 2010 Content Type Hub

SharePoint Interview Questions and Answers

Calling ASP.Net WebMethod using jQuery AJAX