Returns true if the provided predicate function returns false for all elements in a collection, false otherwise.

Use IEnumerable.ToArray(), Array.Exists() to test if all elements in the collection return false based on the predicate function, match.
Omit the predicate function, match, to use the overload that checks if each value is null by default.

继续阅读 30秒学会 C# 片段 – None

Returns the difference between two collections, after applying the provided function to each element of both.

Use IEnumerable.Select() to map each element of either collection to the desired type.
Use IEnumerable.Except() to only return elements in the second enumerable object and not the first one.

继续阅读 30秒学会 C# 片段 – DifferenceBy

Returns the maximum of a collection, after mapping each element to a value using the provided function.

Use IEnumerable.Select() to map each element to the value returned by the provided selector function, fn.
Use IEnumerable.Max() to get the maximum of the resulting values.

继续阅读 30秒学会 C# 片段 – MaxBy

Returns the last index in an IList that matches the given predicate function, match.

Use Enumerable.Range() to iterate over all indices in data.
Use IEnumerable.Where() to filter out all values in data for which match returns false.
Use IEnumerable.Last() to return only the last matching index.

继续阅读 30秒学会 C# 片段 – FindIndexOfLastBy

Returns the first index in an IList that matches the given predicate function, match.

Use Enumerable.Range() to iterate over all indices in data.
Use IEnumerable.Where() to filter out all values in data for which match returns false.
Use IEnumerable.First() to return only the first matching index.

继续阅读 30秒学会 C# 片段 – FindIndexOfFirstBy

Returns true if the provided predicate function returns true for all elements in a collection, false otherwise.

Use IEnumerable.ToArray(), Array.TrueForAll() to test if all elements in the collection return true based on the predicate function, match.
Omit the predicate function, match, to use the overload that checks if each value is different from null by default.

继续阅读 30秒学会 C# 片段 – All

Returns the average of a collection, after mapping each element to a value using the provided function.

Use IEnumerable.Select() to map each element to the value returned by the provided selector function, fn.
Use IEnumerable.Average() to get the average of the resulting values.

继续阅读 30秒学会 C# 片段 – AverageBy