Created
April 13, 2020 01:10
-
-
Save wackoisgod/4047dbb15db347f2332efb8632275966 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
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using System.Reflection; | |
using System.Text.RegularExpressions; | |
namespace TestEventTracking | |
{ | |
public class MatchStartedEventArgs : EventArgs | |
{ | |
} | |
class Program | |
{ | |
public static List<KeyValuePair<Delegate, EventArgs>> deferredEvents2 = new List<KeyValuePair<Delegate, EventArgs>>(); | |
public static event EventHandler<MatchStartedEventArgs> MatchStarted; | |
static void RaiseMatchStarted() | |
{ | |
if (MatchStarted == null) | |
{ | |
return; | |
} | |
deferredEvents2.Add(new KeyValuePair<Delegate, EventArgs>(MatchStarted, new MatchStartedEventArgs())); | |
} | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Hello World!"); | |
MatchStarted += Program_MatchStarted; | |
RaiseMatchStarted(); | |
foreach (KeyValuePair<Delegate, EventArgs> pair in deferredEvents2) | |
{ | |
pair.Key.Method.Invoke(null, new object[] { null, pair.Value }); | |
} | |
} | |
private static void Program_MatchStarted(object sender, MatchStartedEventArgs e) | |
{ | |
Console.WriteLine("I like candy"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment