I'd like to take the following if possible and combine them:
public static T[] ForEach<T>(this T[] TArray, Action<T> doWhat)
{
foreach (var item in TArray)
{
doWhat(item);
}
return TArray;
}
The above handles array, below handles lists
public static IEnumerable<T> ForEach<T>(this IEnumerable<T> TList, Action<T> action)
{
foreach (var item in TList)
action(item);
return TList;
}
Is there something in common that both inherit from or implement as an interface?