C# 11 added a small piece of syntax with a surprising amount of machinery behind it. A type can now declare what + does when the surrounding code is overflow-checked, separately from what it does by default:
public static Amount operator +(Amount a, Amount b) => /* wraps */; public static Amount operator checked +(Amount a, Amount b) => /* throws */; Open an assembly that uses this in a decompiler that predates the feature and you get a type with a + operator and, sitting beside it, a stray public method called op_CheckedAddition that no C# syntax seems to produce. The decompiler is not wrong about the bytes — that method really exists. It is wrong about what the bytes mean. This post walks the lowering and shows what Glass.NET has to recognise to give the keyword back.
The real question
There is one keyword, checked, and there are two methods. A checked(a + b) and an ordinary a + b read almost identically in source, yet one has to reach a method that throws on overflow and the other a method that wraps. How does a single lexical context at the call site pick between two physically distinct methods in metadata — and how does a decompiler run that backwards, from the method names and the call tokens, to the operator checked + declaration the author actually wrote?
Both operators, side by side
Here is a value type that carries both forms of addition. The unchecked one wraps, the checked one traps:
public readonly struct Amount { public int Value { get; } public Amount(int value) => Value = value; public static Amount operator +(Amount a, Amount b) => new(unchecked(a.Value + b.Value)); public static Amount operator checked +(Amount a, Amount b) => new(checked(a.Value + b.Value)); } The language rule is that a checked operator may be declared only if its unchecked counterpart exists too — operator checked + requires operator +. The compiler needs a method to call in an unchecked context, which is the default, so the unchecked form is the mandatory one and the checked form is the optional add-on.
What the compiler emits
Both operators become static methods with the specialname flag. The names are where the whole scheme lives: the regular one keeps the reserved name op_Addition, and the checked one gets Checked spliced in after op_, giving op_CheckedAddition. Their bodies differ by exactly one instruction.
.method public hidebysig specialname static valuetype Amount op_Addition(valuetype Amount a, valuetype Amount b) cil managed { ldarga.s a call instance int32 Amount::get_Value() ldarga.s b call instance int32 Amount::get_Value() add // wraps on overflow newobj instance void Amount::.ctor(int32) ret } .method public hidebysig specialname static valuetype Amount op_CheckedAddition(valuetype Amount a, valuetype Amount b) cil managed { ldarga.s a call instance int32 Amount::get_Value() ldarga.s b call instance int32 Amount::get_Value() add.ovf // the one instruction that differs newobj instance void Amount::.ctor(int32) ret } The add versus add.ovf inside the bodies is an implementation detail of these two methods — it is not what a caller selects on. A caller never names an instruction; it names a method. So the decision a checked context drives is the choice of op_Addition or op_CheckedAddition at the call, not the choice of opcode inside either body.
The full family follows the same rule. The checked forms a type may declare are op_CheckedAddition, op_CheckedSubtraction, op_CheckedMultiply, op_CheckedDivision, op_CheckedUnaryNegation, op_CheckedIncrement, op_CheckedDecrement, and op_CheckedExplicit for conversions. Each one is the reserved name of its unchecked twin with Checked inserted after op_.
The call site chooses
Which method the compiler calls is decided entirely by the lexical context around the use — the same checked/unchecked rule that governs built-in arithmetic:
var wrap = a + b; // unchecked (the default) → op_Addition var trap = checked(a + b); // checked expression → op_CheckedAddition checked { var t2 = a + b; } // checked block → op_CheckedAddition call valuetype Amount Amount::op_Addition(valuetype Amount, valuetype Amount) // wrap call valuetype Amount Amount::op_CheckedAddition(valuetype Amount, valuetype Amount) // trap call valuetype Amount Amount::op_CheckedAddition(valuetype Amount, valuetype Amount) // t2 A whole-project <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> (the /checked compiler option) flips the default context to checked for every expression that is not inside an explicit unchecked, so a bare a + b then routes to op_CheckedAddition with no keyword in the source. And the fallback matters: if Amount declared only operator +, every checked(a + b) would still compile — the compiler calls op_Addition because there is nothing checked to call. The checked method is reached only when it exists and the context asks for it.
Reading it in Glass
Glass treats op_Checked* as first-class operator names. When it sees a specialname static method whose name is one of the checked family, with the arity the operator requires, it renders the declaration with the keyword in place — public static Amount operator checked +(Amount a, Amount b) — and keeps it paired with the unchecked operator + it was required to accompany. At each call site, it resolves the method token: a call to op_CheckedAddition becomes checked(a + b), and a run of consecutive statements all calling checked forms folds into a single checked { } block, which is the shape the author most likely wrote.
If you want to see the mechanism rather than the result, open the assembly and switch a method between the C# and IL views. Line up each checked(...) in the source against the call to an op_Checked* method in the IL, and note that the opcode inside those methods (add.ovf) never appears at the call site — the caller only ever names a method. That is the whole feature in one screen: the keyword is carried by which method is called, not by any instruction the caller emits.
Conversions reuse one name
Checked conversions are the sharp edge. Every checked conversion operator, regardless of target type, compiles to the single reserved name op_CheckedExplicit:
public static explicit operator checked int(Amount a) => checked((int)a.Value); public static explicit operator checked short(Amount a) => checked((short)a.Value); .method public hidebysig specialname static int32 op_CheckedExplicit(valuetype Amount a) cil managed .method public hidebysig specialname static int16 op_CheckedExplicit(valuetype Amount a) cil managed Two methods, same name, same single parameter, different return type. The CLI keeps both because a method's signature includes its return type; C# cannot express two ordinary methods that differ only by return type — that is error CS0111. The only legal C# syntax is the conversion operator, where the target type is part of the declaration. So for op_CheckedExplicit, rendering it as an operator is not a readability choice; it is the only form that compiles. Glass disambiguates the two by the return type carried in each call token and emits explicit operator checked int and explicit operator checked short accordingly.
When a naive decompiler breaks
A decompiler whose operator table predates C# 11 does not recognise any op_Checked* name. Two failure modes follow, and both compile, which is what makes them dangerous.
On the declaration side it emits the method literally: public static Amount op_CheckedAddition(Amount a, Amount b). That compiles, and it is wrong — the type has silently lost its checked behaviour, because a recompiled checked(a + b) now has no checked operator to find and falls back to the wrapping op_Addition. On the use side, every checked(a + b) the author wrote comes back as Amount.op_CheckedAddition(a, b), a method call standing where an expression stood. For the conversion case the naive output does not even compile: two op_CheckedExplicit methods side by side are a CS0111 duplicate, with no obvious cause because each method reads fine alone.
Keep one distinction straight: this is entirely separate from the built-in overflow opcodes. checked((byte)n) on a primitive is conv.ovf.u1 — an instruction, not a method — and there is no op_ anything involved. That instruction-level case, including the asymmetries where checked emits no special opcode at all, is covered in how checked arithmetic decompiles; the broader operator-reconstruction picture is in how operator overloads decompile. This post is only the named-method half: the operators a type declares, not the opcodes the compiler emits for the built-ins.
Takeaway
A checked user-defined operator is a naming convention plus a flag: op_Checked*, specialname, and the right arity, sitting beside its unchecked twin. The keyword the author wrote is not in either method body — it is recoverable only from which method each call site selected, which in turn was fixed by the lexical checked context at compile time. Glass.NET reads the name, the flag, the arity and the call token together, so it can hand back operator checked + and checked(a + b) instead of a stray op_CheckedAddition. Glass is a free .NET decompiler for inspecting code you have the right to inspect — your own assemblies, your dependencies, and third-party binaries you are licensed to analyse — and preserving the checked operator is the difference between source that reads right and source that runs right.