Check if current thread is background thread
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| C# Code Snippets |
| See also |
| edit |
This C# code snippet checks whether the current thread is a background thread by examining the IsBackground property of the current thread.
class ThreadBackground { public static void Main() { Thread thread = Thread.CurrentThread; Console.WriteLine ("IsBackground: {0}", thread.IsBackground); } }
| Thread.CurrentThread.IsBackground (program output) |
| IsBackground: False |