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

How To Insert Or Add Emojis In Microsoft Teams Status Message

Pass GUID As Parameter To Action Using ASP.NET MVC ContribGrid