Answers for "create dictionary using linq c#"

C#
2

c# linq to dictionary

var dict = TableObj.ToDictionary( t => t.Key, t => t.TimeStamp );
Posted by: Guest on September-08-2020
0

c# new dictionary linq

var result = 
  // as Jon Skeet pointed out, OrderBy is useless here, I just leave it 
  // show how to use OrderBy in a LINQ query
  myClassCollection.OrderBy(mc => mc.SomePropToSortOn)
                   .ToDictionary(mc => mc.KeyProp.ToString(), 
                                 mc => mc.ValueProp.ToString(), 
                                 StringComparer.OrdinalIgnoreCase);
Posted by: Guest on May-29-2020

C# Answers by Framework

Browse Popular Code Answers by Language