什么是Func键,何时以及如何使用这些数据如何使用、数据、Func

由网友(▲ 乱人心°)分享简介:什么是 Func键<> 键,它是干什么用的。What is Func and what is it used for?推荐答案Func键< T> 是predefined委托类型的返回的一些值的方法 T 的类型。Func is a predefined delegate type...

什么是 Func键<> 键,它是干什么用的。

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

推荐答案

Func键&LT; T&GT; 是predefined委托类型的返回的一些值的方法 T 的类型。

Func<T> is a predefined delegate type for a method that returns some value of the type T.

在换句话说,你可以使用这种类型来引用返回 T 的某个值的方法。例如,

In other words, you can use this type to reference a method that returns some value of T. E.g.

public static string GetMessage() { return "Hello world"; }

这样就可以被引用

may be referenced like this

Func<string> f = GetMessage;
阅读全文

相关推荐

最新文章