Bitwise operators - CSharp Language Basics

CSharp examples for Language Basics:Operator

Introduction

C# supports the following bitwise operators:

OperatorMeaningSample expressionResult
~ Complement ~0xfU0xfffffff0U
& And0xf0 & 0x33 0x30
|Or 0xf0 | 0x33 0xf3
^ Exclusive Or 0xff00 ^ 0x0ff00xf0f0
<<Shift left 0x20 << 20x80
>>Shift right 0x20 >> 10x10

Related Tutorials