Do Int bitwise exclusive-OR operation in CSharp

Description

The following code shows how to do Int bitwise exclusive-OR operation.

Example


    //from w  ww.  j a  va 2 s  . c  o  m

using System;
class MainClass
{
    static void Main()
    {
        int a = 0x0c;
        a ^= 0x06;
        Console.WriteLine("0x{0:x8}", a);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    C# Language »




C# Hello World
C# Operators
C# Statements
C# Exception