In life, I can’t understand why all the faces are not zero. I assume .ForAll() should be executed before I call the .All() method, but is it not?
public class Foo { public string Bar { get; set; } } static void Main(string[] args) { var foos = new List<Foo> { new Foo(), new Foo(), new Foo() }; var newFoos = foos .AsParallel() .Select(x => { x.Bar = ""; return x; }); newFoos.ForAll(x => x = null); var allFoosAreNull = newFoos.All(x => x == null); Console.WriteLine(allFoosAreNull);
source share