CodeGeneratorOptions Classe

Définition

Représente un ensemble d'options utilisées par un générateur de code.

public ref class CodeGeneratorOptions
public class CodeGeneratorOptions
type CodeGeneratorOptions = class
Public Class CodeGeneratorOptions
Héritage
CodeGeneratorOptions

Exemples

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

Remarques

CodeGeneratorOptions est passé aux méthodes de génération de code d’une ICodeGenerator implémentation pour spécifier les options utilisées pendant la génération du code.

La IndentString propriété spécifie la chaîne à utiliser pour chaque retrait d’espacement. La BracingStyle propriété spécifie le style de placement pour les accolades indiquant les limites des blocs de code. La ElseOnClosing propriété spécifie s’il faut ajouter un elsebloc , catchou finally , y compris des crochets, à la ligne fermante de chaque if bloc ou try . La BlankLinesBetweenMembers propriété spécifie s’il faut insérer des lignes vides entre les membres.

Une ICodeGenerator implémentation peut fournir des options de génération de code personnalisées auxquelles vous pouvez définir ou transmettre des données à l’aide de l’indexeur Item[] de dictionnaire, qu’un générateur de code peut rechercher pour rechercher des options de génération de code supplémentaires.

Notes

Cette classe contient une demande de lien et une demande d’héritage au niveau de la classe qui s’applique à tous les membres. Une SecurityException valeur est levée lorsque l’appelant immédiat ou la classe dérivée n’a pas l’autorisation de confiance totale. Pour plus d’informations sur les demandes de sécurité, consultez Demandes de lien et demandes d’héritage.

Constructeurs

CodeGeneratorOptions()

Initialise une nouvelle instance de la classe CodeGeneratorOptions.

Propriétés

BlankLinesBetweenMembers

Obtient ou définit une valeur indiquant s'il faut insérer des lignes vides entre les membres.

BracingStyle

Obtient ou définit le style à utiliser pour les accolades.

ElseOnClosing

Obtient ou définit une valeur indiquant s'il faut ajouter un bloc else, catch ou finally, y compris les parenthèses, au niveau de la ligne fermante de chaque bloc if ou try précédent.

IndentString

Obtient ou définit la chaîne à utiliser pour les mises en retrait.

Item[String]

Obtient ou définit l'objet à l'index spécifié.

VerbatimOrder

Obtient ou définit une valeur qui indique s'il faut générer des membres dans l'ordre dans lequel ils se produisent dans les collections de membres.

Méthodes

Equals(Object)

Détermine si l'objet spécifié est égal à l'objet actuel.

(Hérité de Object)
GetHashCode()

Fait office de fonction de hachage par défaut.

(Hérité de Object)
GetType()

Obtient le Type de l'instance actuelle.

(Hérité de Object)
MemberwiseClone()

Crée une copie superficielle du Object actuel.

(Hérité de Object)
ToString()

Retourne une chaîne qui représente l'objet actuel.

(Hérité de Object)

S’applique à