Can a method be attached to a delegate with predefined parameters?

前端 未结 2 1636
故里飘歌
故里飘歌 2020-12-21 09:14

Sometimes I encounter cases where I have to attach a method to a delegate but the signature doesn\'t match, like trying to attach abc down there to somedelegate with the str

2条回答
  •  既然无缘
    2020-12-21 10:19

    Just Googling for '.net delegate optional parameters' returns some results that may be useful:

    • Can a Delegate have an optional parameter?
    • VB.NET - Is there a way to utilize optional parameters in delegates? (Or Plans to Allow this?)
    • Optional Parameters and Delegates

    Update (researching this some more, and helped by the first link above):

    Could you perhaps use the Invoke method, which accepts any delegate?

提交回复
热议问题