Skip to main content
Formatting
Source Link
Zymus
  • 2.5k
  • 5
  • 23
  • 36

One possibility that might work is to make two new interfaces

public interface ASenderReceiver {
    void SendA();
    void Close();

}

}

public interface BSenderReceiver {
    void SendB();
    void Close();
}

}

Then create a composite class

public class ABSenderReceiver : ASenderReceiver, BSenderReceiver {
    private readonly ASenderReceiver A;
    private readonly BSenderReceiver B;

    public void SendA() {
        A.SendA();
   }

    public void SendB() {
        B.SendB();
   } 

    public void A.Close() {
        A.Close();
   } 

    public void B.Close() {
        B.Close();
   }  
} 

}

Then pass the new class around in your code.

One possibility that might work is to make two new interfaces

public interface ASenderReceiver {
    void SendA();
    void Close();

}

public interface BSenderReceiver {
    void SendB();
    void Close();

}

Then create a composite class

public class ABSenderReceiver : ASenderReceiver, BSenderReceiver {
    private readonly ASenderReceiver A;
    private readonly BSenderReceiver B;

    public void SendA() {
        A.SendA();
   }

    public void SendB() {
        B.SendB();
   } 

    public void A.Close() {
        A.Close();
   } 

    public void B.Close() {
        B.Close();
   } 

}

Then pass the new class around in your code.

One possibility that might work is to make two new interfaces

public interface ASenderReceiver {
    void SendA();
    void Close();
}

public interface BSenderReceiver {
    void SendB();
    void Close();
}

Then create a composite class

public class ABSenderReceiver : ASenderReceiver, BSenderReceiver {
    private readonly ASenderReceiver A;
    private readonly BSenderReceiver B;

    public void SendA() {
        A.SendA();
   }

    public void SendB() {
        B.SendB();
   } 

    public void A.Close() {
        A.Close();
   } 

    public void B.Close() {
        B.Close();
   }  
} 

Then pass the new class around in your code.

Source Link
Zymus
  • 2.5k
  • 5
  • 23
  • 36

One possibility that might work is to make two new interfaces

public interface ASenderReceiver {
    void SendA();
    void Close();

}

public interface BSenderReceiver {
    void SendB();
    void Close();

}

Then create a composite class

public class ABSenderReceiver : ASenderReceiver, BSenderReceiver {
    private readonly ASenderReceiver A;
    private readonly BSenderReceiver B;

    public void SendA() {
        A.SendA();
   }

    public void SendB() {
        B.SendB();
   } 

    public void A.Close() {
        A.Close();
   } 

    public void B.Close() {
        B.Close();
   } 

}

Then pass the new class around in your code.