Skip to content

Instantly share code, notes, and snippets.

@LaraSQP
Created September 20, 2022 02:23
Show Gist options
  • Save LaraSQP/00345ef063f14ff2faf759b3560e4f61 to your computer and use it in GitHub Desktop.
Save LaraSQP/00345ef063f14ff2faf759b3560e4f61 to your computer and use it in GitHub Desktop.
public class Example
{
public event EventHandler<string> PassString;
public event EventHandler<( Keys key, int x, bool modified )> PassMultipleValues;
private void NotifySubscribers()
{
PassString?.Invoke( this, "some text" );
PassMultipleValues?.Invoke( this, ( Keys.Up, 1, true ) );
}
}
...
public class Main
{
private Example _example = new();
public Main()
{
_example.PassString += OnPassString();
_example.PassMultipleValues += ( _, e ) => SomeOtherMethod( e.key, e.x, e.modified );
}
private void OnPassString( object sender, string text )
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment