I'm an Objective-C developer porting an application to the .Net world. In my Obj-C application, I use NSNotification objects to communicate asynchronously between a handful of objects. Is there some way to do something similar in the .Net world (more specifically, using the C# language)? The fundamental approach is that one object posts a notification that one or more objects listen for.
There's probably an obvious way of doing this, but I haven't found it yet...
Using Delegates in C# or VB.NET is the equivalent language integrated feature. You can create events by defining or using a predefined Delegate to define the "notification" that can be published and subscribed to. Then define an event on a class that you can subscribe to and raise. The MSDN documentation has a good overview once you find it here. A good example is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With