C# 属性

C# 抽象

C# 字符串

C# 泛型

C# 杂项

C# 新特性

C# Main Thread Example 主线程示例

在进程中创建的第一个线程称为主线程。它首先开始,最后结束。

让我们看一个 C# 中的主线程示例。

例子 (Example)

using System;  
using System.Threading;  
public class ThreadExample  
{  
    public static void Main(string[] args)  
    {  
        Thread t = Thread.CurrentThread;  
        t.Name = "主线程";  
        Console.WriteLine(t.Name);  
    }  
}

输出:

主线程


  • 使用社交账号登录,本站支持
全部评论(0)