Use LINQ with Dictionary : select : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » select »

 

Use LINQ with 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;
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» select