Web Service 中委托无法序列化的问题
public delegate double FunDelegate(double param);
[Serializable]
class IntergralOperation
{
private FunDelegate fun = null;//被积函数
private double lowerLimit;//积分下限
private double upperLimit;//积分上限
static public double Result;//返回结果
public IntergralOperation(FunDelegate f, double lL, double uL)
{
this.fun = f;
this.lowerLimit = lL;
this.upperLimit = uL;
}//构造函数
public override void Operation()
{
//积分运算
}
}
public class Service : System.Web.Services.WebService
{
[WebMethod(Description = "求定积分")]
public double Intergral(FunDelegate f, double lL, double uL)
{
MathOperation mo = MathOperationFactory.IntergralOperationInstance(f, 0, 1);
mo.Operation();
return IntergralOperation.Result;
}
}
为什么会提示“FunDelegate 无法序列化,因为它没有无参数的构造函数”?应该如何解决?