Donate

How To Sort Dictionary<TKey,TValue> Object By Value Or By Key Using LINQ In C#

Here's a code I got from StackOverflow on how to sort dictionary object by value or by key using LINQ in C#.
var sortedDict = (from entry in SortedWebsiteNames orderby entry.Value   
ascending select entry).ToDictionary(pair => pair.Key, pair => pair.Value);  
var sortedDict = (from entry in SortedWebsiteNames orderby entry.Value   
ascending select entry).ToDictionary(pair => pair.Key, pair => pair.Value);

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.

Invalid nested tag div found, expected closing tag input