Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

>>=: practical reference

>>=: practical reference: >>= shifts right and assigns the result to the left location.

Version: C# operator reference; verified against C# 14

Syntax

left >>= right

= shifts right and assigns the result to the left location.

Use it for staged decoding of numbers and masks.

A signed value preserves its sign, which can prevent convergence to zero.

The shift count is masked and the operation is not atomic.

The complete program actually uses >>=; its exact expected stdout is 4.

Examples

using System;
using System.Linq;
using System.Threading.Tasks;

var value = 16; value >>= 2; Console.WriteLine(value);

Result

4

The complete program actually uses `>>=`; its exact expected stdout is `4`.

Sources