I have an array of ListViewItems ( ListViewItem[]
), where I store a SalesOrderMaster
object in each ListViewItem.Tag for later reference.
I ha
Like Marc Gravell said, you shouldn't access the Tag
property from different threads, and the cast is quite cheap, so you have:
var items = (e.Argument as ListViewItem[]).Select(x=>x.Tag)
.OfType().ToList();
but then, you want to find distinct items - here you can try using AsParallel
:
var orders = items.AsParallel().Distinct();