Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio .NET
Reference
Visual C# Language
C# Compiler Options
 /optimize (Enable/Disable Optimizat...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2003/.NET Framework 1.1

Other versions are also available for the following:
Visual C# Language Concepts
/optimize (Enable/Disable Optimizations)
/optimize[+ | -]

Remarks

The /optimize option enables or disables optimizations performed by the compiler to make your output file smaller, faster, and more efficient. /optimize also tells the common language runtime to optimize code at runtime.

By default, /optimize- is in effect. Specify /optimize+ to enable optimizations.

When building a module to be used by an assembly, use the same /optimize settings as those of the assembly.

/o is the short form of /optimize.

It is possible to combine the /optimize and /debug options.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C# Project Properties.
  2. Click the Configuration Properties folder.
  3. Click the Build property page.
  4. Modify the Optimize code property.

To set this compiler option programmatically

See Optimize Property.

Example

Compile t2.cs and enable compiler optimizations:

csc t2.cs /optimize

See Also

C# Compiler Options

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker