CKTIS / C#
-=: practical reference
-=: practical reference: -= subtracts and assigns; for an event it unsubscribes a delegate.
Version: C# operator reference; verified against C# 14
Syntax
left -= right-= subtracts and assigns; for an event it unsubscribes a delegate.
Use it to update a counter or perform a symmetric unsubscribe.
Removing a different delegate instance may do nothing, and arithmetic is not atomic.
Overflow follows checked context, while the left location is evaluated once.
The complete program actually uses -=; its exact expected stdout is 5.
Examples
using System;
using System.Linq;
using System.Threading.Tasks;
var value = 9; value -= 4; Console.WriteLine(value);
Result
5
The complete program actually uses `-=`; its exact expected stdout is `5`.