C # Linq expansion method

The following methods are IEnumerable <T> extension method:

Average calculating an average value; Min smallest element; Max the maximum element; Total Sum element; Count the number of elements;

Concat connecting two sequences; // Unoin all equivalent to sql

Contains sequence contains a specified element;

Distinct sequence acquired distinct elements;

Except obtaining the difference between two sets of sequences;

Intersect obtain the intersection of two sequences;

First get the first element in the sequence;

Single element to obtain a unique sequence number if an element is not, then the error;

FirstOrDefault obtain a first sequence of elements, an element if no default value is returned;

Linq only for paradigm sequence, IEnumerable <T>, for non-generic type, or may be Cast OfType

IEnumerable method:

Cast <TResult>: Linq due to the type of operation for the paradigm, the old version of .Net the like for non-generic type IEnumerable sequence can be converted to a paradigm sequence by Cast Method. ArrayList l; IEnumerable <int> il = l.Cast <int> ();

OfType <TResult>: Cast attempts to sequence all the elements are converted to type TResult, non-generic type sequence if to be converted contain other types, an error is reported. OfType is singled out only the sequence of the specified type conversion element to paradigm sequence.

Guess you like

Origin www.cnblogs.com/exyz/p/11984695.html