例如:
public interface IFoo
{
//...
ICollection<IFoo> Children { get; }
//...
}
public class Foo : IFoo
{
//...
public ICollection<Foo> Children { get; private set; }
//...
public ICollection<IFoo> IFoo.Children
{
get
{
return Children; // Obviously wrong datatype, how do I cast this?
}
}
//...
}
那么我该如何正确实施IFoo.Children
呢?我试过Children.Cast<IFoo>
了,但这IEnumerable<IFoo>
会返回一个。