.Net Interview Question: What is use of Interlocked Class?

Interlocked class provides methods by which you can achieve following functionalities

  • Increment Values
  • Decrement values
  • Exchange values between variables
  • Compare values from any thread.in a synchronization mode

Example: System.Threading.Interlocked.Increment(IntA)