What is Func, how and when is it used

前端 未结 8 1820
悲哀的现实
悲哀的现实 2020-11-27 10:53

What is Func<> and what is it used for?

8条回答
  •  鱼传尺愫
    2020-11-27 11:07

    Maybe it is not too late to add some info.

    Sum:

    The Func is a custom delegate defined in System namespace that allows you to point to a method with the same signature (as delegates do), using 0 to 16 input parameters and that must return something.

    Nomenclature & how2use:

    Func funcDelegate = someMethod;
    

    Definition:

    public delegate TResult Func(T arg);
    

    Where it is used:

    It is used in lambda expressions and anonymous methods.

提交回复
热议问题