zoukankan      html  css  js  c++  java
  • System.Threading.Thread的使用及传递参数等总结

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading;

    namespace ConsoleApplication3
    {
    class Program
    {
    static void Main(string[] args)
    {
    //线程启动One()
    Thread t = new Thread(() => One());
    t.Start();

    //线程启动One(object p) 方法一(传递参数)
    Thread tt = new Thread(() => One("mang"));
    tt.Start();

    //线程启动Two(object p) 方法二(传递参数)
    Thread ttt = new Thread(new ParameterizedThreadStart(Two));
    ttt.Start("mangmang");
    Console.ReadLine();

    //构造函数
    //new Thread(ThreadStart start) 初始化Thread类的新实例
    //start 类型:System.Threading.ThreadStart
    // ThreadStart委托,它表示此线程开始执行时要调用的方法。
    }

    static void One()
    {
    Console.WriteLine("One");
    }

    static void One(object p)
    {
    Console.WriteLine("One's parameter is " + p.ToString());
    }

    static void Two(object p)
    {
    Console.WriteLine("Two's parameter is " + p.ToString());
    }
    }
    }

  • 相关阅读:
    Region-Based Segmentation
    不同特征值对应的特征向量
    Edge Linking
    Canny Edge Detector
    度量与非度量方法
    Edge detection using LoG
    Sobel算子
    Edge Model
    Laplacian算子
    图像处理中的一阶导数与二阶导数
  • 原文地址:https://www.cnblogs.com/asdyzh/p/9869948.html
Copyright © 2011-2022 走看看