I'm populating an observable collection with the following:
var customers = new ObservableCollection<Customer>();
foreach (
var customer in
collListItem.Select(
item =>
new Customer
{
Persona = item["Persona"].ToString(),
CustomerName = item["Title"].ToString()
}))
{
customers.Add(customer);
}
Before I populate a WPF datagrid with the elements from this collection I'd like to make it a unique list of personas and customers (no duplicate rows).
I tried to use the following for this:
customers = customers.Distinct();
However I received the error:
Cannot convert source type 'System.Collections.Generic.IEnumerable to target type 'System.Collections.ObjectModel.ObservableCollection
Is there an equivalent for an ObservableCollection
that I can use?