zoukankan      html  css  js  c++  java
  • 委托事件 简写与原来写法 (临时函数)转

     public MainPage()
            {
                
    this.InitializeComponent();

                
    //简写
                this.Loaded += (sender, e) => { MessageBox.Show("d"); MessageBox.Show("ss"); };
                
    //原来写法
                this.Loaded +=new RoutedEventHandler(MainPage_Loaded);
            }

            
    void MainPage_Loaded(object sender, RoutedEventArgs e)
            {
                
    //简写
                this.Dispatcher.BeginInvoke(() => MessageBox.Show("dd"));
                
    //原来写法
                this.Dispatcher.BeginInvoke(test);
            }

            
    void test()
            {
                MessageBox.Show(
    "dd");
            }

  • 相关阅读:
    php设计模式-适配器
    遍历Map的4种方法
    遍历数组
    遍历List的方法
    复选框选中
    单选框选中
    正向代理和反向代理
    对于Dubbo的理解
    python远程控制Linux
    python对中文的处理
  • 原文地址:https://www.cnblogs.com/fej121/p/2149835.html
Copyright © 2011-2022 走看看