lambda 怎么传递ref参数

Posted 诺贝尔

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了lambda 怎么传递ref参数相关的知识,希望对你有一定的参考价值。

lambda 传递ref参数有个语法bug,必须要显式书写参数类型。

//
delegate bool FuncType(ref int num);

FuncType func1;
func1 = num => true; //
func1 = (ref num) => true;//
func1 = (ref int num) => true;//ok

//并且,当一个参数书写类型,其他参数也要书写,总之很烦。

以上是关于lambda 怎么传递ref参数的主要内容,如果未能解决你的问题,请参考以下文章