Не похоже, что .All(..) имеет перегрузку что дает индекс? Я хочу сделать что-то вроде:
Код: Выделить всё
bool result = list.All((element, index) => {
// for example:
return element != null && index % 2 == 0;
// (my actual condition is more complicated, but that's not the point of the question)
});
Код: Выделить всё
bool result = list.Select((element, index) => {
// for example:
return element != null && index % 2 == 0;
}).All(identity => identity);
Есть ли более идиоматический способ сделать это?
Подробнее здесь: https://stackoverflow.com/questions/791 ... item-index
Мобильная версия