zoukankan      html  css  js  c++  java
  • C#异步回调

    异步回调是指异步执行一个带回调函数的方法;代码如下

     class Program
        {
            static void Main(string[] args)
            {
                Action<string> A1 = new Action<string>(Show);
                A1.BeginInvoke("Hello", Callback, "回调参数");
                Console.Read();
            }
            //回调方法
            public static void Callback(IAsyncResult ar)
            {
                object str = ar.AsyncState as string;
                Console.WriteLine(str);
            }
            //委托方法
            public static void Show(string str)
            {
                Console.WriteLine(str);
            }
        }

    输出结果是:Hello

                    回调参数

  • 相关阅读:
    hinge loss
    KL散度
    pygame 学习
    pytorch 反向传播
    在线画数学函数图
    recover deleted files
    98个关键点的人脸
    Pytorch详解BCELoss和BCEWithLogitsLoss
    one hot vector
    Effective C++
  • 原文地址:https://www.cnblogs.com/Rmeo/p/2623698.html
Copyright © 2011-2022 走看看