What is the difference between Func and delegate?

后端 未结 4 939
谎友^
谎友^ 2020-12-23 18:49

I see delegates in two forms:

A. Func convertMethod = lambda 

B. public delegate string convertMethod(string value);

4条回答
  •  轮回少年
    2020-12-23 19:25

    A initializes an instance of a delegate (that can be called immediately). It's a variable of type Func< string, string >.

    B specifies the definition of a delegate (its signature). It can be used to later define variables of type convertMethod.

提交回复
热议问题