CodeGeneratorOptions Classe

Definição

Representa um conjunto de opções usadas por um gerador de código.Represents a set of options used by a code generator.

public ref class CodeGeneratorOptions
public class CodeGeneratorOptions
type CodeGeneratorOptions = class
Public Class CodeGeneratorOptions
Herança
CodeGeneratorOptions

Exemplos

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

Comentários

CodeGeneratorOptions é passado para os métodos de geração de código de uma ICodeGenerator implementação para especificar as opções usadas durante a geração de código.CodeGeneratorOptions is passed to the code generation methods of an ICodeGenerator implementation to specify options used during code generation.

A IndentString propriedade especifica a cadeia de caracteres a ser usada para cada recuo de espaçamento.The IndentString property specifies the string to use for each spacing indentation. A BracingStyle propriedade especifica o estilo de posicionamento para chaves que indicam os limites dos blocos de código.The BracingStyle property specifies the placement style for braces indicating the boundaries of code blocks. A ElseOnClosing propriedade especifica se é para acrescentar else um catch bloco, ou finally , incluindo colchetes, na linha de fechamento de cada if try bloco ou.The ElseOnClosing property specifies whether to append an else, catch, or finally block, including brackets, at the closing line of each if or try block. A BlankLinesBetweenMembers propriedade especifica se as linhas em branco devem ser inseridas entre os membros.The BlankLinesBetweenMembers property specifies whether to insert blank lines between members.

Uma ICodeGenerator implementação pode fornecer opções de geração de código personalizadas que você pode definir ou passar dados usando o Item[] indexador de dicionário, que um gerador de código pode pesquisar para localizar opções de geração de código adicionais.An ICodeGenerator implementation can provide custom code generation options which you can set or pass data to using the Item[] dictionary indexer, which a code generator can search through to locate additional code generation options.

Observação

Esta classe contém uma demanda de link e uma demanda de herança no nível de classe que se aplica a todos os membros.This class contains a link demand and an inheritance demand at the class level that applies to all members. Um SecurityException é lançado quando o chamador imediato ou a classe derivada não tem permissão de confiança total.A SecurityException is thrown when either the immediate caller or the derived class does not have full-trust permission. Para obter detalhes sobre as demandas de segurança, consulte demandas de link e demandas de herança.For details about security demands, see Link Demands and Inheritance Demands.

Construtores

CodeGeneratorOptions()

Inicializa uma nova instância da classe CodeGeneratorOptions.Initializes a new instance of the CodeGeneratorOptions class.

Propriedades

BlankLinesBetweenMembers

Obtém ou define um valor que indica se linhas em branco são ou não inseridas entre membros.Gets or sets a value indicating whether to insert blank lines between members.

BracingStyle

Obtém ou define o estilo de chaves a ser usado.Gets or sets the style to use for bracing.

ElseOnClosing

Obtém ou define um valor que indica se um bloco else, catch ou finally, incluindo os colchetes, deve ou não ser acrescentado na linha de fechamento de cada bloco if ou try anterior.Gets or sets a value indicating whether to append an else, catch, or finally block, including brackets, at the closing line of each previous if or try block.

IndentString

Obtém ou define a cadeia de caracteres a ser usada para recuos.Gets or sets the string to use for indentations.

Item[String]

Obtém ou define o objeto no índice especificado.Gets or sets the object at the specified index.

VerbatimOrder

Obtém ou define um valor que indica se os membros devem ou não ser gerados na ordem em que ocorrem em coleções de membros.Gets or sets a value indicating whether to generate members in the order in which they occur in member collections.

Métodos

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object.

(Herdado de Object)

Aplica-se a