System.CodeDom.Compiler.CodeGeneratorOptions Class

Represents a set of options used by a code generator.

See Also: CodeGeneratorOptions Members


public class CodeGeneratorOptions


System.CodeDom.Compiler.CodeGeneratorOptions is passed to the code generation methods of an System.CodeDom.Compiler.ICodeGenerator implementation to specify options used during code generation.

The CodeGeneratorOptions.IndentString property specifies the string to use for each spacing indentation. The CodeGeneratorOptions.BracingStyle property specifies the placement style for braces indicating the boundaries of code blocks. The CodeGeneratorOptions.ElseOnClosing property specifies whether to append an else, catch, or finally block, including brackets, at the closing line of each if or try block. The CodeGeneratorOptions.BlankLinesBetweenMembers property specifies whether to insert blank lines between members.

An System.CodeDom.Compiler.ICodeGenerator implementation can provide custom code generation options which you can set or pass data to using the CodeGeneratorOptions.Item(string) dictionary indexer, which a code generator can search through to locate additional code generation options.


This class contains a link demand and an inheritance demand at the class level that applies to all members. A System.Security.SecurityException is thrown when either the immediate caller or the derived class does not have full-trust permission. For details about security demands, see Link Demands and Inheritance Demands.


Namespace: System.CodeDom.Compiler
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0,,