TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

C# Thread Class

C# Thread class for beginners and professionals with examples on overloading, method overriding, inheritance, aggregation, base, polymorphism, sealed, abstract, interface, namespaces, exception handling, file io, collections, multithreading, reflection etc.

<< Back to C

C# Thread class

C# Thread class provides properties and methods to create and control threads. It is found in System.Threading namespace.

C# Thread Properties

A list of important properties of Thread class are given below:

PropertyDescription
CurrentThreadreturns the instance of currently running thread.
IsAlivechecks whether the current thread is alive or not. It is used to find the execution status of the thread.
IsBackgroundis used to get or set value whether current thread is in background or not.
ManagedThreadIdis used to get unique id for the current managed thread.
Nameis used to get or set the name of the current thread.
Priorityis used to get or set the priority of the current thread.
ThreadStateis used to return a value representing the thread state.

C# Thread Methods

A list of important methods of Thread class are given below:

MethodDescription
Abort()is used to terminate the thread. It raises ThreadAbortException.
Interrupt()is used to interrupt a thread which is in WaitSleepJoin state.
Join()is used to block all the calling threads until this thread terminates.
ResetAbort()is used to cancel the Abort request for the current thread.
Resume()is used to resume the suspended thread. It is obselete.
Sleep(Int32)is used to suspend the current thread for the specified milliseconds.
Start()changes the current state of the thread to Runnable.
Suspend()suspends the current thread if it is not suspended. It is obselete.
Yield()is used to yield the execution of current thread to another thread.
Next TopicC# Main Thread




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf