//Calling event handlers directly via delegate to see the difference //Here, the client do have the flexibility to pass null and subscribers can also interfere with one another public void Encode(Video video, VideoEncodedEventHandler videoEncodedEventHandler) { Console.WriteLine("Encoding video..."); Thread.Sleep(3000); videoEncodedEventHandler(this, EventArgs.Empty); }
protected virtual void OnVideoEncoded(Video video) { VideoEncodedEventHandler?.Invoke(this, new VideoEventArgs() { Video = video }); }