On using SomeCollection.AsParallel().ForAll(), the count of the resulted collection is less when compared to the actual input collection
List<int> someCollection = new List<int>{1,2,3,4,5,6,7,8,9,10};
List<string> resultCollection1 = new List<string>();
List<string> resultCollection2 = new List<string>();
// Using AsParallel - Results in incorrect result
someCollection.AsParallel().ForAll(x => {
resultCollection1 .Add(x.ToString());
});
// Using ForEach - Results in correct result
someCollection.ForEach(x => {
resultCollection2 .Add(x.ToString());
});
Excepting the count of someCollection should be equal to resultCollection1 and resultCollection2