本文整理匯總了C#中System.Threading.Thread.CurrentContext屬性的典型用法代碼示例。如果您正苦於以下問題:C# Thread.CurrentContext屬性的具體用法?C# Thread.CurrentContext怎麽用?C# Thread.CurrentContext使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Threading.Thread
的用法示例。
在下文中一共展示了Thread.CurrentContext屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
//引入命名空間
using System;
using System.Threading;
class Program {
static void Main(string[] args) {
Thread primaryThread = Thread.CurrentThread;
primaryThread.Name = "ThePrimaryThread";
Console.WriteLine("Name of current AppDomain: {0}", Thread.GetDomain().FriendlyName);
Console.WriteLine("ID of current Context: {0}", Thread.CurrentContext.ContextID);
Console.WriteLine("Thread Name: {0}", primaryThread.Name);
Console.WriteLine("Has thread started?: {0}", primaryThread.IsAlive);
Console.WriteLine("Priority Level: {0}", primaryThread.Priority);
Console.WriteLine("Thread State: {0}", primaryThread.ThreadState);
}
}