Tag Archives: events

Swift events

Swift does not have built-in .NET-like events. (I admit, I was used to have them in C#, although implementing the weak pattern in .NET was not the easiest job either.) Instead, in Swift there are two common patterns that developers (and even Apple) … Continue reading

Posted in Swift | Tagged , , , , , | 3 Comments

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