Callbacks in C#

后端 未结 5 1419
孤独总比滥情好
孤独总比滥情好 2020-12-28 17:52

I want to have a library that will have a function in it that accepts an object for it\'s parameter.

With this object I want to be able to call a specified function

5条回答
  •  情话喂你
    2020-12-28 18:46

    The object in question will need to implement an interface provided by you. Take the interface as a parameter, and then you can call any method that the interface exposes. Otherwise you have no way of knowing what the object is capable of. That, or you could take a delegate as a parameter and call that.

提交回复
热议问题