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 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

Calculates the greatest common divisor of the given numbers.

Define a GCD() function for two numbers, which uses recursion.
Base case is when y equals 0, which returns x.
Otherwise the GCD of y and the remainder of the division x/y is returned.
Define an overload that accepts multiple numbers or an array and use IEnumerable.Aggregate() to apply GCD() to them.

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