I’m trying to make a simple parallel.For and It seems to be getting the same “i” over and over again.
My code is:
String[] str = new String[10000];
Parallel.For(0,10000, i=>
{
if(str[i] == string.Empty)
str[i] = "ok";
else
str[i] = "SameValue";
});
I would expect it to never get to “else”
string.Emptydoes not equalnull, change your if condition toif (String.IsNullOrEmpty(str[i]))