-4

I need help with this

ParallelOptions parallelOption = new ParallelOptions()
{
    MaxDegreeOfParallelism = 1000
};
Parallel.ForEach<string>(strs, parallelOption, (string a0, ParallelLoopState a1, long a2)
     => new VB$AnonymousDelegate_0<string, ParallelLoopState, long, object>((string url, ParallelLoopState i, long j) 
     => {

VB$AnonymousDelegate_0< is giving me an error

Gangaraju
  • 4,406
  • 9
  • 45
  • 77
Jimmy
  • 1

1 Answers1

0

You're using a lambda in a place where the compiler should be able to infer types.

So, you should be able to do

Parallel.ForEach(
    strs, 
    parallelOption
    (s, state, i) => {
        // lambda body
    });

without any other work. The type of s will be inferred from the type of strs, and the other two types will be inferred by overload resolution finding the Parallel.ForEach call.

Related link

Community
  • 1
  • 1
jdphenix
  • 15,022
  • 3
  • 41
  • 74