Oops sent too quickly.

 ICollection<Customer> data = GetCustomers();
 Parallel.ForEach(
 data,
 (source) =>
{
    DisplayableCustomer destination = new DisplayableCustomer();
   Mapper.Map(source, destination);
   customers.Add(destination);
});

 later on I order the data.

 var sorted = from c in customers orderby c.ZipCode descending select c;

 the error, occurs ( very rarely)  in the   orderby c.ZipCode
NullReferenceException :  c is null.

What am I doing wrong?  the parallel should all complete when it finishes
right, it's not waiting for thread pools to be created / deleted and
returning before the data is done?

the ICollection is a List<Customer> but I could change that to a threadsafe
list if needed.

Davy,

The US Congress voted Pizza sauce a vegetable. Don't even try to convince
me of anything in the states is sane any more!

Reply via email to