当前位置:网站首页>C # implement callback

C # implement callback

2022-06-21 08:22:00 kuilaurence

The callback is Action And lambda Combine to implement generics T Parameters of type ;

static void Main(string[] args)
    {
    
        int a = 25;
        int c = 0;
        ConsoleLog(a, (res) =>
        {
    
            c = res;
        });
        Console.WriteLine(c);
    }
    public static void ConsoleLog(int a, Action<int> callback)
    {
    
        int b = 11;
        callback(b + a);
    }

Common analogies list sort Functions, etc .

原网站

版权声明
本文为[kuilaurence]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206210819214425.html