There is no ForEach extension for IEnumerable; only for List. So you could do
items.ToList().ForEach(i => i.DoStuff());
Alternatively, write your own ForEach extension:
public static void ForEach<T>(this IEnumerable<T> enumeration, Action<T> action)
{
foreach(T item in enumeration)
{
action(item);
}
}
Комментариев нет:
Отправить комментарий