program.cs
来自「Take this material and refer. very usefu」· CS 代码 · 共 30 行
CS
30 行
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Project2
{
class Program
{
static void Main(string[] args)
{
Thread newThread = new Thread(new ThreadStart(OtherFunction));
newThread.Start();
Console.WriteLine("Main thread going off to sleep");
Thread.Sleep(1000);
Console.WriteLine("Main thread has woken up. Returning");
}
static void OtherFunction()
{
Thread.CurrentThread.IsBackground = true;
for (int i=1; i<=20; i++)
{
Console.WriteLine("Inside the new thread. Current iteration = " + i);
Thread.Sleep(100);
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?