Unity new UI. Working with scripts.

I have a little problem here.
I have 2 buttons. For example A and B.
And if i press A button, it sends a listener to onClick. But i need to remove this listener when i press B button.
Generally, onClick.AddListener() works perfectly, but i don’t no how should i use onClick.RemoveListener(). I tried it but didnt work. Help me please.
P.S. Please, don’t offer to use RemoveAllListeners.

RemoveListener removes the action you send to it from the event. You send the method itself. Notice the lack of parenthesis after the name of the method on lines 6 and 10.

public class Handler {
  Button button;

  // Call this where you need to add the listener
  public void AddHandler() {

  // Button B calls this
  public void RemoveHandler() {

  public void HandleClick() {
    // Do stuff

I’m not sure if you can do this to remove a listener you set through the inspector.