CodeGeneratorOptions クラスとは? わかりやすく解説

CodeGeneratorOptions クラス

コード ジェネレータ使用するオプションセット表します

名前空間: System.CodeDom.Compiler
アセンブリ: System (system.dll 内)
構文構文

Public Class CodeGeneratorOptions
Dim instance As CodeGeneratorOptions
public class CodeGeneratorOptions
public ref class CodeGeneratorOptions
public class CodeGeneratorOptions
public class CodeGeneratorOptions
解説解説

CodeGeneratorOptions は、コード生成中に使用するオプション指定するために、ICodeGenerator 実装コード生成メソッド渡されます。

IndentString プロパティは、各インデント幅に使用する文字列指定します。BracingStyle プロパティは、コード ブロック境界を示す中かっこ配置スタイル指定します。ElseOnClosing プロパティは、if ブロックtry ブロック終了行に、elsecatchfinally の各ブロック中かっこ含めて追加するかどうか指定します。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";
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
  System.CodeDom.Compiler.CodeGeneratorOptions
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CodeGeneratorOptions メンバ
System.CodeDom.Compiler 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CodeGeneratorOptions クラス」の関連用語

CodeGeneratorOptions クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CodeGeneratorOptions クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS