Bitwise operation
/*
C# Programming Tips & Techniques
by Charles Wright, Kris Jamsa
Publisher: Osborne/McGraw-Hill (December 28, 2001)
ISBN: 0072193794
*/
namespace nsBitwise
{
using System;
public class Bitwise345
{
static public void Main ()
{
char ch = 'a';
char toggle = (char) 0x20;
for (int x = 0; x < 4; ++x)
{
Console.WriteLine ("In iteration {0}, ch = {1}",
x + 1, (char) ch);
ch = (char) (ch ^ toggle);
}
}
}
}
Related examples in the same category