- Published on
Why Doesn't IEnumerable<T> Have a ForEach Method?
.NET.NET-CoreC#
In C#, types like List<T> (and others such as ImmutableList<T>) include a convenient ForEach method. It can be seen as a more functional-style alternative to the traditional foreach loop. For example: