Venciity

[C#] Dictionary Example

Jan 9th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. // sorce : http://www.dotnetperls.com/dictionary
  2. using System;
  3. using System.Collections.Generic;
  4.  
  5. class Program
  6. {
  7.     static void Main()
  8.     {
  9.         Dictionary<string, int> dictionary =
  10.             new Dictionary<string, int>();
  11.         dictionary.Add("cat", 2);
  12.         dictionary.Add("dog", 1);
  13.         dictionary.Add("llama", 0);
  14.         dictionary.Add("iguana", -1);
  15.  
  16.         foreach (var world in dictionary)
  17.         {
  18.             Console.WriteLine("{0} is memberid: {1}", world.Value, world.Key);
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment