委托
private delegate Decimal OperateDelegate(Decimal operand1,Decimal operand2);
private Decimal Add(Decimal operand1,Decimal operand2)
{
return operand1 + operand2;
}
private Decimal Subtract(Decimal operand1,Decimal operand2)
{
return operand1 - operand2;
}
private Decimal Multiply(Decimal operand1,Decimal operand2)
{
return operand1 * operand2;
}
private Decimal Divide(Decimal operand1,Decimal operand2)
{
if(operand2 == 0)
{
OnDevideByZero += new DevideByZeroEventHandler(frmDelegateDemo_OnDevideByZero);
if(OnDevideByZero != null)
{
DevideByZeroEventArgs args = new DevideByZeroEventArgs();
OnDevideByZero(this,args);
}
return 0;
}
return operand1 / operand2;
}
private delegate Decimal OperateDelegate(Decimal operand1,Decimal operand2);
private Decimal Add(Decimal operand1,Decimal operand2)
{
return operand1 + operand2;
}
private Decimal Subtract(Decimal operand1,Decimal operand2)
{
return operand1 - operand2;
}
private Decimal Multiply(Decimal operand1,Decimal operand2)
{
return operand1 * operand2;
}
private Decimal Divide(Decimal operand1,Decimal operand2)
{
if(operand2 == 0)
{
OnDevideByZero += new DevideByZeroEventHandler(frmDelegateDemo_OnDevideByZero);
if(OnDevideByZero != null)
{
DevideByZeroEventArgs args = new DevideByZeroEventArgs();
OnDevideByZero(this,args);
}
return 0;
}
return operand1 / operand2;
}
解决方案 »
- string[]转换string失败
- 【Word释放】关于C#操作Word后快速释放的问题(环境为:C#开发的ActiveX嵌套在IE中使用--开发Word在线编辑器时出现的问题)
- C#的[]
- 通过URL抓取音频、视频等文件的播放地址
- 不知道在水晶报表中得到双击的某一列的值
- 如何把Excel里的Sheet标签与每个Sheet标签里的数据动态读到(或绑定到)TreeView里去,很急很急,在线等……
- 请教高手,我的机器是win200 server 我把asp.net程序放在局域网里的另一台计算机里,而用我的机器的虚拟目录指向另一台计算机
- 求MSDN Library for Visual Studio .NET 2003在线浏览地址,或下载地址,中英文均可。
- C# 断开数据库以后
- 关于C#控制excel表
- 求一IP地址的正则表达式
- 字节数组与指针的问题?
+=是个重载运算符,实际目的是新增一个handler