-
-
Save jasondown/e08a54302ef92ebf05c138f421521d74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Car | |
{ | |
private readonly Radio _radio; | |
public event EventHandler<RadioEventArgs> RadioTogglePower; | |
public Car(Radio radio) | |
{ | |
// omitting guard clause | |
_radio = radio; | |
_radio.TogglePower += OnRadioTogglePower; | |
} | |
private void OnRadioTogglePower(object sender, RadioEventArgs e) | |
{ | |
if (RadioTogglePower != null) RadioTogglePower(sender, e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment