Interlocked.Decrement : Interlocked « System.Threading « C# / C Sharp by API






Interlocked.Decrement

  

using System;
using System.Threading;

class MainClass
{
    public static void Main()
    {
        int firstInt = 25;
        int secondInt = 80;

        Console.WriteLine("firstInt initial value = {0}", firstInt);
        Console.WriteLine("secondInt initial value = {0}", secondInt);

        Interlocked.Decrement(ref firstInt);

        Console.WriteLine("firstInt after decrement = {0}", firstInt);


    }
}

   
    
  








Related examples in the same category

1.Interlocked.Add
2.Interlocked.CompareExchange
3.Interlocked.Exchange
4.Interlocked.Increment