CodeGeneratorOptions クラス
アセンブリ: System (system.dll 内)


CodeGeneratorOptions は、コード生成中に使用するオプションを指定するために、ICodeGenerator 実装のコード生成メソッドに渡されます。
IndentString プロパティは、各インデント幅に使用する文字列を指定します。BracingStyle プロパティは、コード ブロックの境界を示す中かっこの配置スタイルを指定します。ElseOnClosing プロパティは、if ブロックや try ブロックの終了行に、else、catch、finally の各ブロックを中かっこも含めて追加するかどうかを指定します。BlankLinesBetweenMembers プロパティは、各メンバの間に空行を挿入するかどうかを指定します。
ICodeGenerator 実装は、Item ディクショナリ インデクサを使用して、データを設定したり渡すことができるカスタム コード生成オプションを提供できます。コード ジェネレータは、このディクショナリを検索して、追加のコード生成オプションを見つけることができます。
![]() |
---|
このクラスは、すべてのメンバに適用されるリンク確認要求および継承確認要求をクラス レベルで格納します。直前の呼び出し元または派生クラスに完全信頼のアクセス許可がない場合、SecurityException がスローされます。セキュリティ要求の詳細については、「リンク確認要求」および「継承確認要求」を参照してください。 |

' Creates a new CodeGeneratorOptions. Dim genOptions As New CodeGeneratorOptions() ' Sets a value indicating that the code generator should insert blank lines between type members. genOptions.BlankLinesBetweenMembers = True ' Sets the style of bracing format to use: either "Block" to start a ' bracing block on the same line as the declaration of its container, or ' "C" to start the bracing for the block on the following line. genOptions.BracingStyle = "C" ' Sets a value indicating that the code generator should not append an else, ' catch or finally block, including brackets, at the closing line of a preceeding if or try block. genOptions.ElseOnClosing = False ' Sets the string to indent each line with. genOptions.IndentString = " " ' Uses the CodeGeneratorOptions indexer property to set an ' example object to the type's string-keyed ListDictionary. ' Custom ICodeGenerator implementations can use objects ' in this dictionary to customize process behavior. genOptions("CustomGeneratorOptionStringExampleID") = "BuildFlags: /A /B /C /D /E"
// Creates a new CodeGeneratorOptions. CodeGeneratorOptions genOptions = new CodeGeneratorOptions(); // Sets a value indicating that the code generator should insert blank lines between type members. genOptions.BlankLinesBetweenMembers = true; // Sets the style of bracing format to use: either "Block" to start a // bracing block on the same line as the declaration of its container, or // "C" to start the bracing for the block on the following line. genOptions.BracingStyle = "C"; // Sets a value indicating that the code generator should not append an else, // catch or finally block, including brackets, at the closing line of a preceeding if or try block. genOptions.ElseOnClosing = false; // Sets the string to indent each line with. genOptions.IndentString = " "; // Uses the CodeGeneratorOptions indexer property to set an // example object to the type's string-keyed ListDictionary. // Custom ICodeGenerator implementations can use objects // in this dictionary to customize process behavior. genOptions["CustomGeneratorOptionStringExampleID"] = "BuildFlags: /A /B /C /D /E";
// Creates a new CodeGeneratorOptions. CodeGeneratorOptions^ genOptions = gcnew CodeGeneratorOptions; // Sets a value indicating that the code generator should insert blank lines between type members. genOptions->BlankLinesBetweenMembers = true; // Sets the style of bracing format to use: either S"Block" to start a // bracing block on the same line as the declaration of its container, or // S"C" to start the bracing for the block on the following line. genOptions->BracingStyle = "C"; // Sets a value indicating that the code generator should not append an else, // catch or finally block, including brackets, at the closing line of a preceeding if or try block. genOptions->ElseOnClosing = false; // Sets the String* to indent each line with. genOptions->IndentString = " "; // Uses the CodeGeneratorOptions indexer property to set an // example Object* to the type's String*-keyed ListDictionary. // Custom ICodeGenerator* implementations can use objects // in this dictionary to customize process behavior. genOptions[ "CustomGeneratorOptionStringExampleID" ] = "BuildFlags: /A /B /C /D /E";


System.CodeDom.Compiler.CodeGeneratorOptions


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- CodeGeneratorOptions クラスのページへのリンク