FUNC< T,TResult>与无效TResult?
问题描述:
Func键<>
是.NET非常方便。有没有一种方法,我可以指定参数类型,有结果的价值为无效?我想通过无效写入(字符串)
作为参数。
Func<>
is very convenient in .NET. Is there a way i can specify the param type and have the result value as void? I'd like to pass void Write(string)
as a parameter.
答
动作&LT ; T&GT;
- 封装一个方法,需要一个单一的参数,并且没有返回值
Action<T>
- "Encapsulates a method that takes a single parameter and does not return a value"