zoukankan      html  css  js  c++  java
  • 一个简单的委托

     class Delegate123
        
    {
            
    public delegate void HelloHander(string msg);
            
    private void Hello1(string msg)
            
    {
                Console.WriteLine(
    "Hello1"+msg);
            }

            
    private void Hello2(string msg)
            
    {
                Console.WriteLine(
    "Hello2" + msg);
            }

            
    private void Hello3(string msg)
            
    {
                Console.WriteLine(
    "Hello3" + msg);
            }

            
    static void Main(string[] args)
            
    {
                Delegate123 delegate123 
    = new Delegate123();
                HelloHander hello 
    = new HelloHander(delegate123.Hello1);
                hello 
    += new HelloHander(delegate123.Hello2);
                hello 
    += new HelloHander(delegate123.Hello3);
                hello 
    -= new HelloHander(delegate123.Hello2);
                
    if (hello != null)
                    hello(
    "你好");
                Console.ReadLine();
            }

        }

    这个讲的不错:http://blog.csdn.net/Knight94/archive/2006/11/15/1385284.aspx
  • 相关阅读:
    Linux查看密码
    zabbix 邮件报警配置
    Linux 修改zabbix server的web访问端口
    Zabbix 配置监控主机
    Linux 安装zabbix
    Json解析注解 ---@SerializedName
    IntelliJ IDEA 设置背景图片
    @Override is not allowed when implementing interface method
    nginx ------反向代理和负载均衡
    IntelliJ IDEA 性能优化
  • 原文地址:https://www.cnblogs.com/tenghoo/p/1203235.html
Copyright © 2011-2022 走看看