How can I disable compiler optimization in C#?

.net, c#

Solution

At the command line (csc), `/optimize-`

In the IDE, project properties → build → "optimize code"

For some JIT optimizations, you can use `[MethodImpl(...)]`

Problem

How can I disable compiler optimization in C#?

Original source