Dictionary

Different Ways to Iterate Dictionary in C#

Dictionary in C# is a collection of Key value pair under the System.Collections.Generic namespace. Dictionary is optimized for fetching and saving values with constant complexity- O(1)Let us quickly look at ways to iterate over a dictionary. Consider below dictionary Iterate Dictionary using Foreach loop Iterate Dictionary using ForEach Lambda We can dictionary using System.Collections.Generic ForEach …

Different Ways to Iterate Dictionary in C# Read More »

C# Sort Dictionary by Value (Including Object Type Values)

Dictionary in C# is a set of keys and values. Sorting dictionary by value can be confusing since there is no straight method provided for the same in either System.Linq or System.Collections.Generic namespace. Let us discuss different ways to sort dictionary by value. Let us consider below Dictionary Using Linq – Method Syntax Using Linq …

C# Sort Dictionary by Value (Including Object Type Values) Read More »