So I have a
BaseClass
and several child classes that inherit from the baseclass
ChildClass1
ChildClass2
I have ObservableCollections
of child classes that need to be sorted in place, I cannot create a new ObservableCollection<ChildClas1>
.
So i wrote a function
private void Reorder(ObservableCollection<BaseClass>)
{
//sort the collection in place
}
then i do Reorder(ObservableCollection<ChildClass1>)
the compiler is complaining that it cannot convert
System.Collections.ObjectModel.ObservableCollection<ChildClass1>
to ObservableCollection<BaseClass>
I will take the compilers word for it, but how can I achieve this without having to duplicate my reorder function for every single child type?