Tags

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 Syntax abstract class Course { pu...

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 give a lambda expression whi...

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 This operator takes a Type nam...

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 Except, Interse...

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 which we need to get the dat...

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("India"); countries.A...

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. LINQ provides an un...

Continue Reading

LINQ Overview

Welcome to LINQ Tutorials. LINQ provides an uniform and powerful SQL like query language in C#/VB.NET to query different data sources. In the tutorial, we will learn all to basics and advanced LINQ language and how to use it your own projects with some live examples. We will go step by step first when LINQ introduced and its main features, LINQ Query Operators. Then how to use LINQ with dif...

Continue Reading