access dic by key c#
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
Dictionary<string, int> dictionary = new Dictionary<string, int>();
dictionary.Add("apple", 1);
dictionary.Add("windows", 5);
// See whether Dictionary contains this string.
if (dictionary.ContainsKey("apple"))
{
int value = dictionary["apple"];
Console.WriteLine(value);
}
// See whether it contains this string.
if (!dictionary.ContainsKey("acorn"))
{
Console.WriteLine(false);
}
}
}IDictionary<int, string> dict = new Dictionary<int, string>();
//or
Dictionary<int, string> dict = new Dictionary<int, string>();
Also in C#:
- how to get specific length of row in matrix c#
- c# resize bitmap
- c# shorten an method
- unity drawline
- transform object according to its parent unity
- asp.net mvc return file
- how to draw a dot in c#
- how to close a form c#
- press key run code unity c#
- random number generator c#
- unity html request
- add row and columns to grid wpf in code
- list clone - C#
- unity c# set gameobject active
- unity prevent system from creation
- how to get component in unity c#
- 2d object look at object
- Rigidbody.addforce
- c# try catch error
- covert char[] to string C#
- how to name GameObject in c#
- c# error "The name 'ViewBag' does not exist in the current context"
- isdaylightsavingtime in c#
- open link c#