delegate 委托一例(2)
来源:互联网 发布:淘宝售后客服管理制度 编辑:程序博客网 时间:2024/05/06 05:57
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleTest{ public delegate void DelgCalc(int iWidth, int iHeight); class delegateClass1 { static void Main() { DelgCalc handler = new DelgCalc(delegateTest.CalcArea); handler(6, 4);//计算面积 handler = new DelgCalc(delegateTest.CalcCircle); handler(5, 4);//计算周长 Console.ReadLine(); } } public class delegateTest { public static void CalcArea(int iWidth, int iHeight) { Console.WriteLine("宽度:{0},高度:{1},面积:{2}", iWidth, iHeight, iWidth * iHeight); } public static void CalcCircle(int iWidth, int iHeight) { Console.WriteLine("宽度:{0},高度:{1},周长:{2}", iWidth, iHeight, (iWidth+ iHeight)*2); } }}
运行效果:
- delegate 委托一例(2)
- delegate 委托一例
- delegate 委托一例(3)
- C#里委托/代理delegate 一例
- 委托(delegate)的应用一
- 委托(Delegate)
- 委托(Delegate)
- delegate委托
- 委托(delegate)
- Delegate 委托
- delegate 委托
- 委托:delegate
- 委托 delegate
- 委托(delegate)
- 委托,delegate
- delegate-委托
- 委托 delegate
- delegate委托
- myeclipse8.5 突然不能打开java jsp等文件
- Sql语句更改字段类型及主键等实用整理
- SQL触发器--插入时判断数据是否已存在
- jquery-ui标签页组件(tabs)学习
- 如果提供Tomcat的并发能力
- delegate 委托一例(2)
- 基于mdev(udev)的驱动架构与linux设备驱动模型之class
- ubuntu 下 ssh 的 GUI 用法
- ubuntu 建立tftp服务器
- 设计模式之享元模式
- matlab中sum函数
- POJ 1005I Think I Need a Houseboat
- flex builer3 与 flash builer4的正式版下载(window and mac)
- HttpURLConnection用法详解