Delen via


OptimizationLevel Enum

Definition

Determines the level of optimization of the generated code.

public enum class OptimizationLevel
public enum OptimizationLevel
type OptimizationLevel = 
Public Enum OptimizationLevel
Inheritance
OptimizationLevel

Fields

Name Value Description
Debug 0

Disables all optimizations and instruments the generated code to improve debugging experience.

The compiler prefers debuggability over performance. Do not use for code running in a production environment.

  • JIT optimizations are disabled via assembly level attribute (DebuggableAttribute).
  • Edit and Continue is enabled.
  • Slots for local variables are not reused, lifetime of local variables is extended to make the values available during debugging.

Corresponds to command line argument /optimize-.

Release 1

Enables all optimizations, debugging experience might be degraded.

The compiler prefers performance over debuggability. Use for code running in a production environment.

  • JIT optimizations are enabled via assembly level attribute (DebuggableAttribute).
  • Edit and Continue is disabled.
  • Sequence points may be optimized away. As a result it might not be possible to place or hit a breakpoint.
  • User-defined locals might be optimized away. They might not be available while debugging.

Corresponds to command line argument /optimize+.

Applies to