次のようなインターフェースがあるとします。
interface MyInterface
{
public string AProperty { get; set;}
public void AMethod ()
}
このインターフェイスは、別のインターフェイス内で使用されます。
interface AnotherInterface
{
public MyInterface member1 { get; set; }
public int YetAnotherProperty {get; set;}
}
ここで、各インターフェイスを実装する 1 つのクラスの 2 つのクラスがあるとします。
class MyInterfaceImpl : MyInterface
{
private string aproperty
public string AProperty
{
//... get and set inside
}
public void AMethod ()
{
//... do something
}
}
そして最後に:
class AnotherInterfaceImpl : AnotherInterface
{
private MyInterfaceImpl _member1;
public MyIntefaceImpl member1
{
//... get and set inside
}
...Other implementation
}
AnotherInterfaceImpl
を実装していないとコンパイラが文句を言うのはなぜMyInterface
ですか?
非常に基本的な質問であることは理解していますが、xml AnotherInterfaceImpl にシリアル化する必要があり、member1 が MyInterface 型の場合はそれを行うことができません。