LINQ

LINQ

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 »

C# LINQ Distinct or Group By. Get Distinct values from Collection of Objects

Microsoft has provided the LINQ Methods under the System.LINQ namespace. It is a very powerful tool to work upon collections/Lists. Let us quickly understand the syntax and concepts for implementing the Distinct method of LINQ under different circumstances. Below is the list of different ways that we will discuss to fetch Distinct Objects. Using Distinct …

C# LINQ Distinct or Group By. Get Distinct values from Collection of Objects Read More »