注册 登录
悉远 返回首页

焰阳小窝 http://bbs.7cuu.com/?1 [收藏] [复制] [分享] [RSS]

日志

委托于事件 p56

已有 1368 次阅读2011-9-28 15:31 |个人分类:asp.net

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        public delegate void Del(string message);


        public static void DelegateMethod(string message)
        {
            System.Console.WriteLine(message);
        }
        public static void MethodWithCallback(int param1, int param2, Del callback)
        {
            callback("最终的数值为:" + (param1 + param2).ToString());
        }

        static void Main(string[] args)
        {
            Del handler = DelegateMethod;
            MethodWithCallback(1, 2, handler);
            System.Console.ReadLine();
        }
    }
}


路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

QQ|QQ客服|联系我们|Archiver|手机版|小黑屋|悉远网络 ( 鄂ICP备09013446号 )

GMT+8, 2024-5-17 18:59 , Processed in 0.029030 second(s), 6 queries , Redis On.

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

返回顶部