带有参数和无效返回的函数类型

问题描述 投票:0回答:1

我想知道为什么这行不通?编译器说void不能与Funct类型一起使用。在这种情况下,我有什么选择

  Func<int,void> func1 =  (x) => { Console.WriteLine("Hello World"); };
c# lambda function-pointers
1个回答
0
投票

您正在寻找Action<int>

© www.soinside.com 2019 - 2024. All rights reserved.