什么是Func键,何时以及如何使用这些数据 [英] What is Func, how and when is it used

查看:954
本文介绍了什么是Func键,何时以及如何使用这些数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是 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;

这篇关于什么是Func键,何时以及如何使用这些数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆