Tag Archives: multi-threading

Async-await

Every tutorial on async-await support of C# will state that they are helpers that work like this: an async method is just likeĀ ending with an operation completed event being raised; an await method call is just like registering an operation … Continue reading

Posted in .NET, C# | Tagged , , , , | Leave a comment

Raising custom events

How do you define and raise custom events in C#? public event EventHandler<TEventArgs> MyEvent; protected virtual OnMyEvent(TEventArgs e) { if (MyEvent != null) MyEvent(this, e); } This is fine, but now in a multi-threading environment, where things get nasty: suppose … Continue reading

Posted in .NET, C# | Tagged , , | Leave a comment