能不能把带参数的委托的lambda 表达式改成2个参数的?
static Func<double, object> MakeAddNumber(double numberToAdd)
{
return x =>
{
try
{
return x + numberToAdd;
}
catch (Exception ex)
{
return double.NaN;
}
};
}
类似改成这样:
static Func<double,double, object> MakeAddNumber(double numberToAdd)
{
return
x = (d1,d2) =>
{
try
{
return d1 + d2 + numberToAdd;
}
catch (Exception ex)
{
return double.NaN;
}
};
}
不太懂lamda表达式,红色的编译不通过。如果不带numberToAdd参数,能从网上找到例子,带参数的就不会了
------解决方案--------------------static Func<double,double, object> MakeAddNumber(double numberToAdd)
{
return (d1,d2) =>
{
&nb