Queryable.ToDictionary : Queryable « System.Linq « C# / C Sharp by API






Queryable.ToDictionary

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

public class MainClass{
   public static void Main(){
            var q = from m in typeof(int).GetMethods()
                    group m by m.Name into gb
                    select gb;
            Dictionary<string, int> d = q.ToDictionary(k => k.Key, k => k.Count());
   }
}

   
    
  








Related examples in the same category

1.Queryable.All
2.Queryable.Concat
3.Queryable.Contains
4.Queryable.Count()
5.Queryable.Distinct()
6.Queryable.Except
7.Queryable.First
8.Queryable.First(filter)
9.Queryable.FirstOrDefault
10.Queryable.Intersect
11.Queryable.Last()
12.Queryable.LastOrDefault(filter)
13.Queryable.LongCount()
14.Queryable.LongCount(filter)
15.Queryable.Max
16.Queryable.Max(filter)
17.Queryable.Min()
18.Queryable.Min(filter)
19.Queryable.OfType
20.Queryable.OrderBy
21.Queryable.OrderByDescending
22.Queryable.Reverse
23.Queryable.SelectMany
24.Queryable.SequenceEqual
25.Queryable.Single
26.Queryable.SingleOrDefault
27.Queryable.Skip
28.Queryable.SkipWhile
29.Queryable.SkipWhile(filter)
30.Queryable.StartsWith
31.Queryable.Sum()
32.Queryable.Sum(projection)
33.Queryable.Take
34.Queryable.TakeWhile
35.Queryable.TakeWhile(filter)
36.Queryable.ThenBy
37.Queryable.ThenByDescending
38.Queryable.ToArray
39.Queryable.ToDictionary(filter)
40.Queryable.ToList()
41.Queryable.Union