特定のクラスを使用するときに使用するインターフェイスの実装を選択するには、ジェネリックを使用せずにクラスをインターフェイスにキャストします。
public interface A
{
void Do_A();
}
public interface B
{
void Do_B();
}
public class Exposer : A, B
{
public void Do_A() { ; }
public void Do_B() { ; }
}
public void Main()
{
// the casts are redundant here,
// because the interface implementation
// is implicit
((A)Exposer).Do_A();
((B)Exposer).Do_B();
}
あなたがにしたい場合は、指定されたインタフェースのメンバーのない実装ですメンバー、明示的な実装を使用除外:あなたは完全なサンプルもの完全な定義もない提供
public class Exposer : A, B
{
void A.Do_A() { ; }
void B.Do_B() { ; }
}
public void Main()
{
// the casts are now required;
// otherwise, you'll get a compiler error
// telling you that the method is inaccessible
((A)Exposer).Do_A();
((B)Exposer).Do_B();
}
をあなたが解決している特定の問題。あなたは何を求めていますか? –