I have an interface defined as:
public interface MyInterface {
object foo { get; set; };
}
and a class that implements that interface:
But a List is emphatically not a List.
Think:
interface IAnimal { }
class Cat : IAnimal { }
class Dog : IAnimal { }
var list = new List { new Cat(), new Dog() };
Then
var cats = (List)list;
Absurd!
Also,
var cats = list.Cast();
Absurd!
Further
var cats = list.ConvertAll(x => (Cat)x);
Absurd!
Instead, you could say
var cats = list.OfType();