Why use “new DelegateType(Delegate)”?

前端 未结 5 1087
时光取名叫无心
时光取名叫无心 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:31

    Both are the same, but the latter syntax was added in C#2 to simplify delegate usage.

    Both methods compile to the same byte code.

提交回复
热议问题