Splits values into two groups.
If an element in filter is true, the corresponding element in the collection belongs to the first group; otherwise, it belongs to the second group.

Use IEnumerable.Where() to separate values into two groups and assign them to the two passed out arrays.

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

Returns true if two collections contain the same elements regardless of order, false otherwise.

Use IEnumerable.GroupBy() to create groups for each distinct value in each collection, IEnumerable.ToDictionary() to convert the result to a Dictionary.
Use IEnumerable.Union() and IEnumerable.Distinct() to find the distinct values from both collections and loop over them using a foreach loop.
Use Dictionary.ContainsKey() to check that each distinct value exists in both collections and compare the count for each one.
Return false if any value is not found in either collection or if any count does not match, true otherwise.

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

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 all distinct values in a collection.

Use IEnumerable.GroupBy() to create groups for each distinct value in the enumerable.
Use IEnumerable.Where() to create select only the groups with a count greater than 1.
Use IEnumerable.Select() to return the Key property of each group.

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