LINQ Element Operators

In LINQ, Element Operators are helpful to find the first or the last element of a list/collection and can also be used to fetch an element based on its index value. The following are the different types of element operators available in LINQ. Topics First FirstOrDefault Last LastOrDefault ElementAt ElementAtOrDefault Single SingleOrDefault LINQ First Operator … Continue reading LINQ Element Operators

LINQ Set Operators

In LINQ, Set Operators are extremely helpful while performing operations like removing duplicates, combining to collections/lists and in extracting common and uncommon values. The following are the different types of set operators available in LINQ. Topics DISTINCT UNION INTERSECT EXCEPT LINQ Distinct Operator Distinct Operator will remove all the duplicates from a list/collection and returns … Continue reading LINQ Set Operators

LINQ Partition Operators

In LINQ, Partition Operators are extremely helpful in dividing a list/collection into two parts and returns only one part of the desired items. The following are the different types of partition operators available in LINQ. Topics TAKE TAKEWHILE SKIP SKIPWHILE LINQ Take Operator Take Operator will return a specified number of elements from the starting … Continue reading LINQ Partition Operators

LINQ Sorting Operator

In LINQ, Sorting Operators are extremely helpful to alter the order of the data (mostly either ascending or descending) based on one or more fields. The following are the different types of sorting operators available in LINQ. Topics ORDER BY ORDER BY DESCENDING THEN BY THEN BY DESCENDING REVERSE LINQ OrderBy Operator OrderBy Operator can be … Continue reading LINQ Sorting Operator

LINQ Filtering Operator-Where Clause

Where clause can be used to specify a particular condition on the data source that we are trying to work on and fetch only the required information. It is not a mandatory thing to use in LINQ but can be used wherever needed… result =my_Datasource.Where(“Our Expression”) LINQ WHERE Function Example using C# using System; using System.Collections.Generic; using … Continue reading LINQ Filtering Operator-Where Clause

LINQ Aggregate Functions

Aggregation functions are used to perform mathematical operations like Sum, Average, Count, Max, and Min on the elements of a collection. An aggregate function returns a single value. Topics LINQ SUM Function LINQ MIN function LINQ MAX function LINQ COUNT function LINQ AVERAGE function LINQ AGGREGATE function LINQ SUM function SUM function can be extremely … Continue reading LINQ Aggregate Functions

LINQ Lambda Expressions – Introduction

Lambda expression is actually a function without a defined name. Useful in places where a method is being used only once, and the method definition should be short and simple. It saves you the effort of declaring and writing a separate method. Though it is not as readable as a LINQ query, internally the LINQ query … Continue reading LINQ Lambda Expressions – Introduction

LINQ Syntax – Quick Guide

Topics What is a QUERY? LINQ Query Syntax LINQ Method Syntax What is a Query? A query is an expression which is used to perform some task. As a developer, you’re expected to learn different types of languages to be able to query different types of data sources like SQL for a relational database, XQuery … Continue reading LINQ Syntax – Quick Guide