get value in dictionary by key
Published: 27. October 2011 | Updated: 27. October 2011License: Microsoft Public License (MS-PL)
Categories: Collections
Tags: Basics C# Collections
Import namespace
using System.Collections.Generic;
Code
var dictionary = new Dictionary<int, string>(); dictionary.Add(1, "a"); dictionary.Add(3, "c"); dictionary.Add(5, "e"); string value = dictionary[3]; Console.WriteLine(value);Console Output:
c
| Send us feedback about this snippet » |





