- 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);
});
Parallel for-each loops in .NET C# z
时间: 2024-10-31 20:32:36