Код: Выделить всё
// a: Does the enumerable contain an item that satisfies the lambda?
bool contains = enumerable.Any(lambda);
// b: How many items satisfy the lambda?
int count = enumerable.Count(lambda);
// c: Return an enumerable that contains only distinct elements according to my custom comparer
var distinct = enumerable.Distinct(comparer);
// d: Return the first element that satisfies the lambda, or throws an exception if none
var element = enumerable.First(lambda);
// e: Returns an enumerable containing all the elements except those
// that are also in 'other', equality being defined by my comparer
var except = enumerable.Except(other, comparer);
Примечание: я не хочу материализовать итерируемый объект в список, если в этом нет необходимости (
Код: Выделить всё
AnyПодробнее здесь: https://stackoverflow.com/questions/120 ... ts-to-linq
Мобильная версия