Kros-sk / Kros.Libs

This repo contains Kros.Utils, Kros.Utils.MsAccess, Kros.KORM and Kros.KORM.MsAccess libraries.
MIT License
7 stars 13 forks source link

ForEach extension for IEnumerable #180

Closed satano closed 5 years ago

satano commented 5 years ago

Sometimes it would be useful to have ForEach extension on IEnumerable, so we do not need to write foreach.

public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)

The LINQ does not have this extension, because LINQ extensions are supposed to be side-effect free (they do not change IEnumerable data) and ForEach is meant to change those data.