C# reflection, interfaces, abstract class, generics, ref vs out, C# versions 4,5,6 and features.

LINQ OrderByDescending Operator

LINQ OrderByDescending operator sort the elements in a sequence in descending order. You can find LINQ sorting operators list here. Below is the syntax of OrderByDescending operator. public static IOrderedEnumerable<TSource> OrderByDescending<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector); As shown in above s...

Continue Reading

LINQ ThenBy Operator

LINQ ThenBy Operator is used when we want to sort the elements in a collection by using multiple properties in ascending order. This operator must use after OrderBy or OrderByDescending operator. First OrderBy operator sort the collection based on a single property and then we can use ThenBy operator to sort the collection by second property. We can use multiple ThenBy opera...

Continue Reading

LINQ OrderBy Operator

LINQ OrderBy operator comes first in LINQ Sorting Operators. OrderBy operator sort the sequence (collection) based on particular property in ascending order. We can use OrderBy operator both in Query Syntax and Method Syntax. Below is the syntax of OrderBy operator. public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(this IEnumerable<TSour...

Continue Reading

LINQ OfType Filtering Operator

OfType comes in Filtering operator category. Here is list of all Query Operators. LINQ OfType operator filter the objects from a collection based on Types. In a collection, we have multiple elements of different Types and we have to select only those objects from the collection that are of specific Type. C# Example of OfType Operator in Query Synt...

Continue Reading

LINQ Where Filtering Operator

LINQ where operator comes in Filtering operators category. Here is a list of all LINQ Operators. Where operator filter the list based on some given criteria. Where operator is an extension method which accept a Func delegate as a parameter. Func accept only a single argument element. An element is passed to argument automatically by LINQ. In the predicate, we'll ...

Continue Reading

LINQ Filtering Operators with Examples in C#

Filtering operators are used to select only those elements from sequence that satisfy a condition. For example, suppose we have ten names in a collection sequence and we have to filter out those names that start with "K". Filtering Operators Description Where Filter elements based on the condition. OfType T...

Continue Reading

LINQ Query Operators

LINQ provides more than 50 query operators for different functionalities. Every query operator is an extension method. These operators can be categorized into following one: Operator Category LINQ Query Operators Names Filtering Where, OfType Sorting OrderBy, OrderByDescending, ThenBy, ThenByDescending Set ...

Continue Reading

LINQ Query Syntax and Method Syntax

LINQ provides two syntax for writing queries. Query syntax Method Syntax Query Syntax Query syntax is like SQL like query syntax. Query syntax is easier to read and write than Method syntax. But Query syntax does not support all query operators of LINQ. A query syntax must begin with a from clause. The from clause specify data source (sequence) from whic...

Continue Reading

LINQ Basics

Before we start learning LINQ language, we must learn some basic knowledge of most used concepts in LINQ. Sequence A sequence is any collection object that implements the IEnumerable<> interface. LINQ queries only works with the sequences. static void Main(string[] args) { List<string> countries = new List<string>(); countries.Add("In...

Continue Reading

LINQ Introduction

LINQ is an acronym for Language Integrated Query. LINQ is introduced in .NET 3.5. Before LINQ, developers need to use different languages for retrieving and saving different data sources. For example if you want to retrieve data from SQL or Oracle database you must learn some basics of SQL query language, and for retrieving data from XML files you need to learn XML parsers...

Continue Reading

Join our newsletter and get an occasional email with a technology and DotNetPattern.com news update.