new Dictionary() : Dictionary « System.Collections.Generic « C# / C Sharp by API






new Dictionary()

  


using System;
using System.Collections.Generic;
using System.Linq;

static class TestDictionary {
    static void Main() {
        Dictionary<int, string> frenchNumbers;
        frenchNumbers = new Dictionary<int, string>();
        frenchNumbers.Add(0, "zero");
        frenchNumbers.Add(1, "one");
        frenchNumbers.Add(2, "two");
        frenchNumbers.Add(3, "three");
        frenchNumbers.Add(4, "four");

        var evenFrenchNumbers =
          from entry in frenchNumbers
          where (entry.Key % 2) == 0
          select entry.Value;
    }
}

   
    
  








Related examples in the same category

1.Dictionary.Keys