LINQ select query data operator

Source: Internet
Author: User

Here are some operators that query data and then select the data again:

First-returns one element in the collection;

FirstOrDefault-Returns the first element in the collection (returns the default value if none);

Last-Returns the final element in the collection;

LastOrDefault-Returns the last element in the collection (default value if not)

ElementAt-Returns the element of the specified index in the collection;

Elementatordefault-Returns the element of the specified index in the collection (if not, returns the default value);

Contains-Determines whether a set contains an element;

Any-determines whether an element in the set satisfies a condition;

All-Determines whether all elements in the collection meet a certain condition;

Count-Returns the number of elements in the collection, returns an int;

LongCount-Returns the number of elements in the collection, returns a long;

Sum-The collection should be a collection of numeric types, and no delay

Min-Returns the minimum value of the collection;

Max-Returns the maximum value of the collection;

Average-The collection should be a collection of numeric types, averaging; no delay

Aggregate-Gets an aggregate value based on the input expression, without delay

Cast-Converts the collection to a strongly typed collection;

DefaultIfEmpty-The default value is returned when the query result is empty;

SequenceEqual-Determines whether two sets are the same;

OfType-Filters The specified type in the collection;

ToArray-Converts the collection to an array;

ToList-Converts the collection to a List<t> collection;

ToDictionary-Converts the collection to <k, v> collection;

LINQ select query data operator

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.