Parallel for-each loops in .NET C# z
时间:2014-05-22 16:01:17
收藏:0
阅读:290
- An IEnumerable object
- An Action of T which is used to process each item in the list
List<string> dataList = new List<string> { "this", "is", "random", "sentence", "hello", "goodbye" }; Parallel.ForEach(dataList, item => { Console.WriteLine("Item {0} has {1} characters", item, item.Length); });
评论(0)