示例#1
0
        static void Main(string[] args)
        {
            TheEvent += Program_TheEvent;

            Console.WriteLine("Enter something:");
            var something = Console.ReadLine();

            if (something.ToLower().Contains("the"))
            {
                TheEvent?.Invoke(null, something);
            }
        }
示例#2
0
 public void RaiseTheEvent(EventArgs eventArgs)
 {
     TheEvent?.Invoke(this, eventArgs);
 }
 protected void OnTheEvent([CallerMemberName] string name = "")
 {
     TheEvent?.Invoke(this, new TestEventArgs(name));
 }
示例#4
0
 public void Fire(object sender, T data)
 {
     TheEvent?.Invoke(sender, new EventArgs <T>(data));
 }
示例#5
0
 public void Raise()
 {
     TheEvent?.Invoke();
 }