Implementing an interface with interface members
- by jstark
What is the proper way to implement an interface that has its own interface members? (am I saying that correctly?) Here's what I mean:
public Interface IFoo
{
string Forty { get; set; }
string Two { get; set; }
}
public Interface IBar
{
// other stuff...
IFoo Answer { get; set; }
}
public class Foo : IFoo
{
public string Forty { get; set; }
public string Two { get; set; }
}
public class Bar : IBar
{
// other stuff
public Foo Answer { get; set; } //why doesnt' this work?
}
I've gotten around my problem using explicit interface implementation, but I'm wondering if there is a better way?