Advantages of using delegates?

前端 未结 14 1379
渐次进展
渐次进展 2020-12-13 11:39

I\'m looking to implement the Observer pattern in VB.NET or C# or some other first-class .NET language. I\'ve heard that delegates can be used for this, but can\'t figure ou

14条回答
  •  孤街浪徒
    2020-12-13 11:59

    i think it is more related to syntatic sugar and a way to organize your code, a good use would be to handle several methods related to a common context which ones belong to a object or a static class.

    it is not that you are forced to use them, you can programme sth with and without them, but maybe using them or not might affect how organized, readable and why not cool the code would be, maybe bum some lines in your code.

    Every example given here is a good one where you could implement them, as someone said it, is just another feature in the language you can play with.

    greetings

提交回复
热议问题