Are the Employee and/or Illness instances thread-safe in this scenario? Does each thread have it own copy of the objects? Originally I thought that each thread would have its own copy, but now I'm not sure.
Parallel.ForEach(line01s, _options, o =>
{
var employee = new Employee();
// set values on employee...Safe?
var illness = new Illness();
// set values on illness...Safe?
employee.AddIllness(illness); // Illness is a property on Employee
}
Is it possible for the Illness object to be set on the wrong Employee object? Do I need to add lock around employee.AddIllness(illness);? The more I work with this TPL stuff, the more I find I don't understand