Introduction - If you have any usage issues, please Google them yourself
For integer data types of simple operation, members of the Interlocked class can be used to achieve thread synchronization, exist in the System.Threading namespace. Interlocked class has the following methods: Increment, Decrement, Exchange and CompareExchange. You can use the Increment and Decrement integer addition and subtraction of a guarantee as an atomic operation. Exchange method of automatic exchange value of the specified variable. CompareExchange method combines two operations: comparing two values and compare the results according to the third value is stored in one variable. Compare and exchange operation is performed by atomic