I am trying to check if one exists before adding but casting within .Any
does not work.
People is ObservableCollection
of objects because each can be different class (each has FirstLastName
property).
ObservableCollection<object> People = new ObservableCollection<object>();
foreach (cEmployee t in Group1)
{
if (!People.Any((cEmployee)x => x.FirstLastName == t.FirstLastName)
People.Add(new cEmployee(t));
}
Is there a workaround?