Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Running List ForEach using script

$
0
0
Based on your ListExtensions class I've created a slightly modified one:
public static class ListExtensions
{
    public static void forEach<T>(this IEnumerable<T> list, dynamic function)
    {
        list.ToList().ForEach(item => function(item));
    }
}
This mimics the JavaScript forEach function for native arrays (at least to some degree) and in addition works both for .NET lists and .NET arrays.

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>