Repository navigation
EN CSharp Operator Assignment
Codex edited this page Oct 11, 2026
·
2 revisions
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Stores the value in a variable or writable member. Composite forms apply the operation and record the result without duplicating the calculation of the left side.
Save this example separately as Example.cs. Run it independently of the other examples on this page.
Example.cs:
// PROJECT-EXAMPLE
int count = 2;
count += 3;
System.Console.WriteLine(count);Result:
5
value = expression / value += amountusing System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
public static class Program
{
public static async Task Main(string[] args)
{
int value = 10;
value += 5; value -= 2; value *= 3; value /= 2; value %= 7;
Console.WriteLine(value);
}
}using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
public static class Program
{
public static async Task Main(string[] args)
{
int mask = 0b0011;
mask |= 0b0100; mask &= 0b0111; mask ^= 0b0001;
mask <<= 2; mask >>= 1; mask >>>= 1;
Console.WriteLine(mask);
}
}Official source: Microsoft Learn.
ClassicUO — Bad Newbie & C# Scripts IDE