| title | ms.date | ms.prod | ms.technology | ms.topic | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | translation.priority.ht | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
-optimize (C# Compiler Options) |
2015-07-20 |
.net |
|
article |
|
|
|
6dd5b6f2-cd1d-4593-a9f4-1c2ed9404ca0 |
15 |
BillWagner |
wiwagn |
|
/optimize (C# Compiler Options)
The /optimize option enables or disables optimizations performed by the compiler to make your output file smaller, faster, and more efficient.
Syntax
/optimize[+ | -] Remarks
/optimize also tells the common language runtime to optimize code at runtime.
By default, optimizations are disabled. 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
-
Open the project's Properties page.
-
Click the Build property page.
-
Modify the Optimize Code property.
For information on how to set this compiler option programmatically, see xref:VSLangProj80.CSharpProjectConfigurationProperties3.Optimize%2A.
Example
Compile t2.cs and enable compiler optimizations:
csc t2.cs /optimize See Also
C# Compiler Options
Managing Project and Solution Properties