CodeGeneratorOptions Třída

Definice

Představuje sadu možností používaných generátorem kódu.

public ref class CodeGeneratorOptions
public class CodeGeneratorOptions
type CodeGeneratorOptions = class
Public Class CodeGeneratorOptions
Dědičnost
CodeGeneratorOptions

Příklady

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

Poznámky

CodeGeneratorOptions je předán metodám ICodeGenerator generování kódu implementace k určení možností použitých během generování kódu.

Vlastnost IndentString určuje řetězec, který se má použít pro každé odsazení mezer. Vlastnost BracingStyle určuje styl umístění pro složené závorky označující hranice bloků kódu. Vlastnost ElseOnClosing určuje, jestli se má na uzavírací čáru elsekaždého if bloku nebo přidat blok , catchnebo finallytry ( včetně hranatých závorek). Vlastnost BlankLinesBetweenMembers určuje, zda se mají vložit prázdné řádky mezi členy.

Implementace ICodeGenerator může poskytovat možnosti vlastního generování kódu, které můžete nastavit nebo předat data pomocí indexeru Item[] slovníku, který může generátor kódu prohledávat a najít další možnosti generování kódu.

Poznámka

Tato třída obsahuje požadavek na propojení a požadavek dědičnosti na úrovni třídy, který se vztahuje na všechny členy. Je SecurityException vyvolán, pokud bezprostředně volající nebo odvozená třída nemá oprávnění k úplnému vztahu důvěryhodnosti. Podrobnosti o požadavcích na zabezpečení najdete v tématu Propojení požadavků a Požadavků dědičnosti.

Konstruktory

CodeGeneratorOptions()

Inicializuje novou instanci CodeGeneratorOptions třídy .

Vlastnosti

BlankLinesBetweenMembers

Získá nebo nastaví hodnotu označující, zda vložit prázdné řádky mezi členy.

BracingStyle

Získá nebo nastaví styl pro závorky.

ElseOnClosing

Získá nebo nastaví hodnotu označující, zda připojit else, catchnebo finally blok, včetně hranatých závorek, na poslední řádek každého předchozího if nebo try bloku.

IndentString

Získá nebo nastaví řetězec pro odsazení.

Item[String]

Získá nebo nastaví objekt v zadaném indexu.

VerbatimOrder

Získá nebo nastaví hodnotu označující, zda chcete generovat členy v pořadí, ve kterém se vyskytují v kolekcích členů.

Metody

Equals(Object)

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

(Zděděno od Object)
GetHashCode()

Slouží jako výchozí hashovací funkce.

(Zděděno od Object)
GetType()

Type Získá z aktuální instance.

(Zděděno od Object)
MemberwiseClone()

Vytvoří mělkou kopii aktuálního Objectsouboru .

(Zděděno od Object)
ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Platí pro