I have a base interface
public interface IBase
{
...
}
and a interface that derives from this base
public interface IChild : IBase
{
...
}
Within my code, I call a method which will return me a List<IBase>
(legacy code). With this List I am trying to fill a ObservableCollection<IChild>
:
List<IBase> baseList= GetListofBase();
ChildList = new ObservableCollection<IChild>();
// how to fill ChildList with the contents of baseList here?
I know it is not possible to cast from a base to a derived interface, but is it possible to create a derived instance from a base interface?