Help with C# messaging.

So i’ve got a C# script that sends a message to a variable gameobject using
Target.SendMessage

I need to create a script that can receive a certain message, for example if my script sends a message called “Toggle” the receiver script should recognize this message and use the single message signal to toggle a boolean.

In example if you’ve got a switch which you press, it sends a single message called toggle, The receiver script recognizes this message and toggles a bool on and off each time it receives this message.

// receveir script
protected bool b = false;

void Toggle() {
 b = !b;
}

// sender script
public GameObject refToGameObject

//if user press button
 refToGameObject.SendMessage("Toggle");
//end if

Something like that? (check send message)
Sorry in advance if I didn’t understand the question.