All the operations of LINQ ienumerable

Source: Internet
Author: User

 

Ienumerable <t> main interface member

 

Member

Function

Aggregate Apply the accumulators function to the sequence. You can specify the accumulate method.
Sum

Calculates the sum of all elements in a sequence. The return values include int, long, float, double, and decimal. You can specify the ing method from the element to the value.

Average

Calculates the average value of all elements in a sequence. The returned values include int, long, float, double, and decimal. You can specify the ing method from the element to the value.

Max Calculates the maximum values of all elements in a sequence. The returned values include int, long, float, double, and decimal. You can specify the ing method from the element to the value.
Min Calculates the minimum values of all elements in a sequence. The returned values include int, long, float, double, and decimal. You can specify the ing method from the element to the value.
All Check whether all elements in the sequence meet the conditions. You can specify the condition judgment method. If all elements meet the conditions, true is returned. Otherwise, false is returned.
Any Check whether any element in the sequence meets the conditions. You can specify the condition judgment method. If more than one element meets the conditions, true is returned; otherwise, false is returned.
Contains Check whether the data series contains specific elements. You can specify equal comparison methods.
Count Returns the number of elements that meet the specified conditions in the sequence. You can specify the condition judgment method.
Longcount Returns the number of elements that meet the specified conditions in the sequence. You can specify the condition judgment method.
Cast Converts an element in ienumerable to a specified data type.
Defaultifempty Returns the element at the specified position in the sequence. If the sequence is null, the default element value is returned.
Elementat Returns the element of the specified index in the sequence.
Elementatordefault Returns the element at the specified index in the sequence. If the sequence is null, the default value is returned.
First Returns the first element in the sequence that meets the specified condition. You can specify the condition judgment method.
Firstordefault Returns the first element in the sequence that meets the specified conditions. If the condition does not exist, the default value is returned. You can also specify the condition determination method.
Last Returns the last element in the sequence that meets the specified condition. You can specify the condition judgment method.
Lastordefault Returns the last element in the sequence that meets the specified conditions. If the condition does not exist, the default value is returned. You can also specify the condition determination method.
Single Returns the unique element in the sequence that meets the specified conditions. If more than one element meets the conditions, a condition judgment method can be specified.
Singleordefault Returns the unique element in the sequence that meets the specified conditions. If no element exists, the default value is returned. If more than one element meets the conditions, a condition judgment method can be specified.
Reverse Reverse the order of elements in a sequence
Distinct Returns a set of non-repeated elements in a sequence. You can specify an equal comparison method.
Concat Connect the two sequences and connect them directly to the beginning and end. Duplicate data may exist in the returned results.
Except Obtains the difference set of two element sets. You can specify the equal comparison method.
Intersect Obtains the intersection of two element sets. You can specify an equal comparison method.
Union Obtains the union of two element sets. You can specify an equal comparison method.

Sequenceequal

Compare the two sequences to see if they are equal. You can specify an equal comparison method.
Where Filters elements in a set based on specified conditions, and returns a set of elements that meet the conditions.
Skip Skips the specified number of elements in the sequence and returns the remaining elements.
Skipwhile Skip the elements that meet the specified conditions in the sequence, and then return the remaining elements. You can specify the condition judgment method.
Take Returns a specified number of continuous elements starting with a sequence.
Takewhile Returns the continuous element that satisfies the specified condition starting from the sequence. You can specify the condition judgment method.
Toarray Create an array from ienumerable <t>
Tolist Create a list from ienumerable <t>

Ienumerable <t> provides the following methods:

Numeric operations (sum, Min, Max, average)

Number of elements (count, longcount)

Values (first, last, elementat, etc)

Extract subset (Skip, skipwhile, take, takewhile ,)

Set Operations (reverse, Concat, distinct, distinct T, intersect, union, sequenceequal, etc)

These methods provide all the operations required by LINQ.

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.