9 lines
285 B
C#
9 lines
285 B
C#
namespace Dlhis.Basic;
|
|
|
|
public static class ParallelExtensions
|
|
{
|
|
public static void ParallelForEach<T>(this IEnumerable<T> source, Action<T> action)
|
|
{
|
|
Parallel.ForEach(source, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, action);
|
|
}
|
|
} |