次の方法で共有


CodeGeneratorOptions クラス

定義

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

public ref class CodeGeneratorOptions
public class CodeGeneratorOptions
type CodeGeneratorOptions = class
Public Class CodeGeneratorOptions
継承
CodeGeneratorOptions

// 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.
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"

注釈

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

プロパティは IndentString 、各間隔インデントに使用する文字列を指定します。 プロパティは BracingStyle 、コード ブロックの境界を示す中かっこの配置スタイルを指定します。 プロパティはElseOnClosing、各ifブロックまたはtryブロックの終了行に、かっこをelse含む、、catchまたは finally ブロックを追加するかどうかを指定します。 プロパティは BlankLinesBetweenMembers 、メンバー間に空白行を挿入するかどうかを指定します。

ICodeGenerator実装では、ディクショナリ インデクサーを使用してデータを設定または渡すことができるカスタム コード生成オプションを提供できます。このオプションを使用するとItem[]、コード ジェネレーターで検索して追加のコード生成オプションを検索できます。

注意

このクラスには、リンク確認要求と、すべてのメンバーに適用されるクラス レベルの継承確認要求が含まれています。 直接の呼び出し元か派生クラスのいずれかに完全信頼アクセス許可がない場合、SecurityException がスローされます。 セキュリティ要求の詳細については、「 リンクの要求 と継承の 要求」を参照してください。

コンストラクター

名前 説明
CodeGeneratorOptions()

CodeGeneratorOptions クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
BlankLinesBetweenMembers

各メンバーの間に空行を挿入するかどうかを示す値を取得または設定します。

BracingStyle

中かっこの記述時に適用するスタイルを取得または設定します。

ElseOnClosing

elsecatchfinally の各ブロックを中かっこも含め、先行する if ブロックまたは try ブロックの終了行に追加するかどうかを示す値を取得または設定します。

IndentString

インデントに使用する文字列を取得または設定します。

Item[String]

指定したインデックスにあるオブジェクトを取得または設定します。

VerbatimOrder

メンバーがメンバー コレクションに現れる順番でメンバーを生成するかどうかを示す値を取得または設定します。

メソッド

名前 説明
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象