public void StructNoCapturedState() { _globalSum = 0; for (int i = 0; i < Elements; ++i) { TaskStubStruct.StartNew(() => { _globalSum += Data.Default.Value; }); } }
public void StructNoStateAndNoLambda() { _globalSum = 0; for (int i = 0; i < Elements; ++i) { TaskStubStruct.StartNew(AddFunction); } }
public void StructPassStateAsParameter() { _globalSum = 0; for (int i = 0; i < Elements; ++i) { var data = new Data { Value = i }; TaskStubStruct.StartNew(d => { _globalSum += (d as Data).Value; }, data); } }
public void StructCaptureState() { _globalSum = 0; for (int i = 0; i < Elements; ++i) { var data = new Data { Value = i }; TaskStubStruct.StartNew(() => { _globalSum += data.Value; }); } }