find and solve || findandsolve.com
Please wait.....

Classification of Standard Query Operators

Standard query operators are clauses that enable you to get the data to be used in a .NET application. These operators provide querying capabilities, which includes filtering, projection, aggregation, and sorting. The standard query operators in LINQ are a part of the Application Programming Interface (API) that enables querying of any .NET array or collection. This implies that standard query operations support the implementation of LINQ applications. You can use these standard query operators to perform a data querying operation on a sequence of data.

Standard query operators differ in the time they take to execute a query. The time taken by a query depends on whether the query returns a single value or a sequence of values. The methods that return a sequence of values take more time to return the output in comparison to the methods that return a single value.

OperatorDescription
Sortingchange the order elements of a sequence returned by a query
SetReturns a result set in the form of a collection based on the presence or absence of elements within the same set or different sets
FilteringRestricts the result set to contain the elements that satisfy a specific condition
ProjectionTransforms an object into a different type of new object
PartitioningDivides the input sequence into two sections, without rearranging the elements, and returns one section
GroupingPuts the data into groups such that elements in each groups that elements in each group share a common attribute
JoinJoins two data sources with objects that share a common attribute in both the data sources
QuantifierReturns a Boolean value, either True or False, indicating whether all or some of the elements in a given sequence satisfy a specific condition
GenerationCreates a new sequence of values
ElementReturns a single, specific elements from a collection
ConversionPerforms data type conversion
AggregateComputes a single value from a collection
EqualityChecks whether two sequences are equal or not
ConcatenationAppends one sequence of elements to another
ZipCombines two collections into one

Let's now learn about all the query operators in each of the operator types in detail.

Sorting Operators

Sorting operators in LINQ arrange the elements of a sequence based on one or more attributes. It means that to use the sorting operator, you first need to specify a particular attribute and perform primary sorting on the elements. Then you need to specify the sort criterion and sort the elements within the primary sorted group. Table 1.2 lists all sorting operators in LINQ.


ClausesDescriptionQuery Expression Syntax (C#)
OrderBySorts a set of elementsin ascending orderorderby
OrderByDescending            Sorts a set of elements in descending orderorderby...descending
ThenByPerforms a secondary sort on a set of elements, in ascending order                   orderby
ThenByDescendingPerforms a secondary sort on a set of elements, in descending order orderby ...descending
ReverseReverses the order of the elements in a sequenceNot available


Sundar  Neupane

Sundar Neupane

I like working on projects with a team that cares about creating beautiful and usable interfaces.

Comments



Report Response