• C# 多线程传递多个参数


    http://www.cnblogs.com/lvdongjie/p/5416883.html

    3. 方式三:采用lambda表达式

    对于lambda表达式不熟悉的可以查看微软MSDN上的说明文档。此处假设你熟悉。因为在大多数使用委托的时候我们一般也可以用lambda表达式的。

     View Code
    using System;
     using System.Threading;
      
     namespace ThreadWithParameters
     {
         class Program
         {
             static void Main(string[] args)
             {
                 string hello = "hello world";
      
                 //如果写成Thread thread = new Thread(ThreadMainWithParameters(hello));这种形式,编译时就会报错
                 Thread thread = new Thread(() => ThreadMainWithParameters(hello));
                 thread.Start();
      
                 Console.Read();
             }
      
             static void ThreadMainWithParameters(string str)
             {
                  Console.WriteLine("Running in a thread,received: {0}", str);
             }
         }
     }


  • 相关阅读:
    apache 错误日志
    搭建服务器
    vim配置
    临时表增加查询速度
    如何清空$_POST or $_GET
    hdu 2084
    快速幂
    zjut 1176
    rwkj 1091
    zjut 1090 --------同余定理的应用
  • 原文地址:https://www.cnblogs.com/LuoEast/p/7753831.html
Copyright © 2020-2023  润新知