Why use “new DelegateType(Delegate)”?

前端 未结 5 1082
时光取名叫无心
时光取名叫无心 2020-12-06 07:15

Ok, suppose you define a delegate in some class.

public delegate void StringDelegate (string s);

and another class implements a method :

5条回答
  •  长情又很酷
    2020-12-06 07:47

    Sometimes the correct type can't be deduced (like when you're calling a generic), in such a case you need to let the compiler know what kind of delegate you want.

    Most of the time, though, naming the method group is easier and clearer.

提交回复
热议问题