Implementing an interface with interface members
Posted
by
jstark
on Stack Overflow
See other posts from Stack Overflow
or by jstark
Published on 2012-09-12T15:27:39Z
Indexed on
2012/09/12
15:38 UTC
Read the original article
Hit count: 290
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?
© Stack Overflow or respective owner