System.CodeDom.Compiler.CodeGenerator Class

Assembly: System.dll
Namespace: System.CodeDom.Compiler
Summary
Provides a helper class for implementing an ICodeGenerator. This class is abstract.
C# Syntax:
public abstract class CodeGenerator : ICodeGenerator
Remarks
This is a useful base class for code generators to derive from. Code generators are capable of rendering source code in a specific language according to the structure of a Code Document Object Model (CodeDOM) graph. This class provides many functions and methods to generate specific types of code from a CodeDOM graph.
See also:
System.CodeDom.Compiler Namespace | ICodeGenerator | CodeCompiler

System.CodeDom.Compiler.CodeGenerator Member List:

Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
IsValidLanguageIndependentIdentifier Gets a value indicating whether the specified value is a valid language-independent identifier.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Protected Constructors
ctor #1 Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Protected Properties
CurrentMember Read-only

Gets the current member of the class.
CurrentMemberName Read-only

Gets the current member name.
CurrentTypeName Read-only

Gets the current class name.
Indent Read-write

Gets or sets the amount of spaces to indent each indentation level.
IsCurrentClass Read-only

Gets a value indicating whether the current object being generated is a class.
IsCurrentDelegate Read-only

Gets a value indicating whether the current object being generated is a delegate.
IsCurrentEnum Read-only

Gets a value indicating whether the current object being generated is an enumeration.
IsCurrentInterface Read-only

Gets a value indicating whether the current object being generated is an interface.
IsCurrentStruct Read-only

Gets a value indicating whether the current object being generated is a value type or struct.
NullToken Read-only

Gets the token that represents null.
Options Read-only

Gets the options to be used by the code generator.
Output Read-only

Gets the TextWriter to use for output.
Protected Methods
ContinueOnNewLine Generates a line-continuation character and outputs the specified string on a new line.
CreateEscapedIdentifier Creates an escaped identifier for the specified value.
CreateValidIdentifier Creates a valid identifier for the specified value.
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
GenerateArgumentReferenceExpression Generates code for the specified argument reference expression.
GenerateArrayCreateExpression Generates code for the specified array creation expression.
GenerateArrayIndexerExpression Generates code for the specified array indexer expression.
GenerateAssignStatement Generates code for the specified assignment statement.
GenerateAttachEventStatement Generates code for the specified attach event statement.
GenerateAttributeDeclarationsEnd Generates code for the specified attribute block end.
GenerateAttributeDeclarationsStart Generates code for the specified attribute block start.
GenerateBaseReferenceExpression Generates code for the specified base reference expression.
GenerateBinaryOperatorExpression Generates code for the specified binary operator expression.
GenerateCastExpression Generates code for the specified cast expression.
GenerateComment Generates code for the specified comment.
GenerateCommentStatement Generates code for the specified comment statement.
GenerateCommentStatements Generates code for the specified comment statements.
GenerateCompileUnit Generates code for the specified compile unit.
GenerateCompileUnitEnd Generates code for the end of a compile unit.
GenerateCompileUnitStart Generates code for the start of a compile unit.
GenerateConditionStatement Generates code for the specified conditional statement.
GenerateConstructor Generates code for the specified constructor.
GenerateDecimalValue Generates code for the specified decimal value.
GenerateDelegateCreateExpression Generates code for the specified delegate creation expression.
GenerateDelegateInvokeExpression Generates code for the specified delegate invoke expression.
GenerateDirectionExpression Generates code for the specified direction expression.
GenerateDoubleValue Generates code for a double-precision floating point number.
GenerateEntryPointMethod Generates code for the specified entry point method.
GenerateEvent Generates code for the specified event.
GenerateEventReferenceExpression Generates code for the specified event reference expression.
GenerateExpression Generates code for the specified code expression.
GenerateExpressionStatement Generates code for the specified expression statement.
GenerateField Generates code for the specified member field.
GenerateFieldReferenceExpression Generates code for the specified field reference expression.
GenerateGotoStatement Generates code for the specified goto statement.
GenerateIndexerExpression Generates code for the specified indexer expression.
GenerateIterationStatement Generates code for the specified iteration statement.
GenerateLabeledStatement Generates code for the specified labeled statement.
GenerateLinePragmaEnd Generates code for the specified line pragma end.
GenerateLinePragmaStart Generates code for the specified line pragma start.
GenerateMethod Generates code for the specified method.
GenerateMethodInvokeExpression Generates code for the specified method invoke expression.
GenerateMethodReferenceExpression Generates code for the specified method reference expression.
GenerateMethodReturnStatement Generates code for the specified method return statement.
GenerateNamespace Generates code for the specified namespace.
GenerateNamespaceEnd Generates code for the end of a namespace.
GenerateNamespaceImport Generates code for the specified namespace import.
GenerateNamespaceImports Generates code for the specified namespace import.
GenerateNamespaces Generates code for the namespaces in the specified compile unit.
GenerateNamespaceStart Generates code for the start of a namespace.
GenerateObjectCreateExpression Generates code for the specified object creation expression.
GenerateParameterDeclarationExpression Generates code for the specified parameter declaration expression.
GeneratePrimitiveExpression Generates code for the specified primitive expression.
GenerateProperty Generates code for the specified property.
GeneratePropertyReferenceExpression Generates code for the specified property reference expression.
GeneratePropertySetValueReferenceExpression Generates code for the specified property set value reference expression.
GenerateRemoveEventStatement Generates code for the specified remove event statement.
GenerateSingleFloatValue Generates code for a single-precision floating point number.
GenerateSnippetCompileUnit Outputs the code of the specified literal code fragment compile unit.
GenerateSnippetExpression Outputs the code of the specified literal code fragment expression.
GenerateSnippetMember Outputs the code of the specified literal code fragment class member.
GenerateSnippetStatement Outputs the code of the specified literal code fragment statement.
GenerateStatement Generates code for the specified statement.
GenerateStatements Generates code for the specified statement collection.
GenerateThisReferenceExpression Generates code for the specified this reference expression.
GenerateThrowExceptionStatement Generates code for the specified throw exception statement.
GenerateTryCatchFinallyStatement Generates code for the specified try...catch...finally statement.
GenerateTypeConstructor Generates code for the specified class constructor.
GenerateTypeEnd Generates code for the specified end class.
GenerateTypeOfExpression Generates code for the specified type of expression.
GenerateTypeReferenceExpression Generates code for the specified type reference expression.
GenerateTypes Generates code for the specified namespace and the classes it contains.
GenerateTypeStart Generates code for the specified start class.
GenerateVariableDeclarationStatement Generates code for the specified variable declaration statement.
GenerateVariableReferenceExpression Generates code for the specified variable reference expression.
GetTypeOutput Gets the name of the specified data type.
IsValidIdentifier Gets a value indicating whether the specified value is a valid identifier.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.
OutputAttributeArgument Outputs an argument in an attribute block.
OutputAttributeDeclarations Generates code for the specified attribute declaration collection.
OutputDirection Generates code for the specified FieldDirection.
OutputExpressionList Overloaded:
OutputExpressionList(CodeExpressionCollection expressions)

Generates code for the specified expression list.
OutputExpressionList Overloaded:
OutputExpressionList(CodeExpressionCollection expressions, bool newlineBetweenItems)

Generates code for the specified expression list.
OutputFieldScopeModifier Outputs a field scope modifier that corresponds to the specified attributes.
OutputIdentifier Outputs the specified identifier.
OutputMemberAccessModifier Generates code for the specified member access modifier.
OutputMemberScopeModifier Generates code for the specified member scope modifier.
OutputOperator Generates code for the specified operator.
OutputParameters Generates code for the specified parameters.
OutputType Generates code for the specified type.
OutputTypeAttributes Generates code for the specified type attributes.
OutputTypeNamePair Generates code for the specified object type and name pair.
QuoteSnippetString Converts the specified string by formatting it with escape codes.
Supports Gets a value indicating whether the specified code generation support is provided.
ValidateIdentifier Throws an exception if the specified value is not a valid identifier.

Hierarchy:


System.CodeDom.Compiler.CodeGenerator Member Details

ctor #1
Summary:
Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
protected CodeGenerator();

Return to top


Property: CurrentMember (read-only)
Summary
Gets the current member of the class.
C# Syntax:
protected CodeTypeMember CurrentMember {get;}
See also:
CodeTypeMember

Return to top


Property: CurrentMemberName (read-only)
Summary
Gets the current member name.
C# Syntax:
protected string CurrentMemberName {get;}
See also:
CodeGenerator.CurrentMemberName

Return to top


Property: CurrentTypeName (read-only)
Summary
Gets the current class name.
C# Syntax:
protected string CurrentTypeName {get;}

Return to top


Property: Indent (read-write)
Summary
Gets or sets the amount of spaces to indent each indentation level.
C# Syntax:
protected int Indent {get; set;}
Remarks
Segments of code are commonly indented for ease of recognition.

Return to top


Property: IsCurrentClass (read-only)
Summary
Gets a value indicating whether the current object being generated is a class.
C# Syntax:
protected bool IsCurrentClass {get;}

Return to top


Property: IsCurrentDelegate (read-only)
Summary
Gets a value indicating whether the current object being generated is a delegate.
C# Syntax:
protected bool IsCurrentDelegate {get;}

Return to top


Property: IsCurrentEnum (read-only)
Summary
Gets a value indicating whether the current object being generated is an enumeration.
C# Syntax:
protected bool IsCurrentEnum {get;}

Return to top


Property: IsCurrentInterface (read-only)
Summary
Gets a value indicating whether the current object being generated is an interface.
C# Syntax:
protected bool IsCurrentInterface {get;}

Return to top


Property: IsCurrentStruct (read-only)
Summary
Gets a value indicating whether the current object being generated is a value type or struct.
C# Syntax:
protected bool IsCurrentStruct {get;}

Return to top


Property: NullToken (read-only)
Summary
Gets the token that represents null.
C# Syntax:
protected abstract string NullToken {get;}
Return Value:
The token that represents null.

Return to top


Property: Options (read-only)
Summary
Gets the options to be used by the code generator.
C# Syntax:
protected CodeGeneratorOptions Options {get;}

Return to top


Property: Output (read-only)
Summary
Gets the TextWriter to use for output.
C# Syntax:
protected TextWriter Output {get;}
See also:
TextWriter

Return to top


Method: ContinueOnNewLine(
   string st
)
Summary
Generates a line-continuation character and outputs the specified string on a new line.
C# Syntax:
protected virtual void ContinueOnNewLine(
   string st
);
Parameters:

st

The string to write on the new line.

Remarks


Notes to implementors: When implementing a code generator for a language that supports a line-continuation character (for example, Visual Basic), this method should output the line-continuation character before it outputs a newline character.

Return to top


Method: CreateEscapedIdentifier(
   string value
)
Summary
Creates an escaped identifier for the specified value.
C# Syntax:
protected abstract string CreateEscapedIdentifier(
   string value
);
Parameters:

value

The string to create an escaped identifier for.

Return Value:
The escaped identifier for the value.
Remarks
CodeGenerator.CreateEscapedIdentifier tests whether the identifer conflicts with reserved or language keywords, and returns an equivalent name with language-specific escape code formatting. Ususally the returned identifier will remain basically the same but will have escape code formatting added to differentiate the identifier from the keyword.

Note The default implementation of this method does not alter any identifier that does not match a list of reserved or language keywords.
See also:
CodeGenerator.CreateValidIdentifier

Return to top


Method: CreateValidIdentifier(
   string value
)
Summary
Creates a valid identifier for the specified value.
C# Syntax:
protected abstract string CreateValidIdentifier(
   string value
);
Parameters:

value

A string to create a valid identifier for.

Return Value:
A valid identifier for the value.
Remarks
CodeGenerator.CreateValidIdentifier tests whether the identifer conflicts with reserved or language keywords, and returns a valid identifier name that does not conflict. Ususally the returned identifier will remain basically the same but will be slightly modified to differentiate the identifier from the keyword.

Note The default implementation of this method does not alter any identifier that does not match a list of reserved or language keywords.
See also:
CodeGenerator.CreateEscapedIdentifier

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~CodeGenerator();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GenerateArgumentReferenceExpression(
   CodeArgumentReferenceExpression e
)
Summary
Generates code for the specified argument reference expression.
C# Syntax:
protected abstract void GenerateArgumentReferenceExpression(
   CodeArgumentReferenceExpression e
);
Parameters:

e

A CodeArgumentReferenceExpression that indicates the expression to generate code for.

See also:
CodeArgumentReferenceExpression

Return to top


Method: GenerateArrayCreateExpression(
   CodeArrayCreateExpression e
)
Summary
Generates code for the specified array creation expression.
C# Syntax:
protected abstract void GenerateArrayCreateExpression(
   CodeArrayCreateExpression e
);
Parameters:

e

A CodeArrayCreateExpression that indicates the expression to generate code for.

See also:
CodeArrayCreateExpression

Return to top


Method: GenerateArrayIndexerExpression(
   CodeArrayIndexerExpression e
)
Summary
Generates code for the specified array indexer expression.
C# Syntax:
protected abstract void GenerateArrayIndexerExpression(
   CodeArrayIndexerExpression e
);
Parameters:

e

A CodeArrayIndexerExpression that indicates the expression to generate code for.

See also:
CodeArrayIndexerExpression

Return to top


Method: GenerateAssignStatement(
   CodeAssignStatement e
)
Summary
Generates code for the specified assignment statement.
C# Syntax:
protected abstract void GenerateAssignStatement(
   CodeAssignStatement e
);
Parameters:

e

A CodeAssignStatement that indicates the statement to generate code for.

See also:
CodeAssignStatement

Return to top


Method: GenerateAttachEventStatement(
   CodeAttachEventStatement e
)
Summary
Generates code for the specified attach event statement.
C# Syntax:
protected abstract void GenerateAttachEventStatement(
   CodeAttachEventStatement e
);
Parameters:

e

A CodeAttachEventStatement that indicates the statement to generate code for.

See also:
CodeAttachEventStatement

Return to top


Method: GenerateAttributeDeclarationsEnd(
   CodeAttributeDeclarationCollection attributes
)
Summary
Generates code for the specified attribute block end.
C# Syntax:
protected abstract void GenerateAttributeDeclarationsEnd(
   CodeAttributeDeclarationCollection attributes
);
Parameters:

attributes

A CodeAttributeDeclarationCollection that indicates the end of the attribute block to generate code for.

See also:
CodeAttributeDeclarationCollection

Return to top


Method: GenerateAttributeDeclarationsStart(
   CodeAttributeDeclarationCollection attributes
)
Summary
Generates code for the specified attribute block start.
C# Syntax:
protected abstract void GenerateAttributeDeclarationsStart(
   CodeAttributeDeclarationCollection attributes
);
Parameters:

attributes

A CodeAttributeDeclarationCollection that indicates the start of the attribute block to generate code for.

See also:
CodeAttributeDeclarationCollection

Return to top


Method: GenerateBaseReferenceExpression(
   CodeBaseReferenceExpression e
)
Summary
Generates code for the specified base reference expression.
C# Syntax:
protected abstract void GenerateBaseReferenceExpression(
   CodeBaseReferenceExpression e
);
Parameters:

e

A CodeBaseReferenceExpression that indicates the expression to generate code for.

See also:
CodeBaseReferenceExpression

Return to top


Method: GenerateBinaryOperatorExpression(
   CodeBinaryOperatorExpression e
)
Summary
Generates code for the specified binary operator expression.
C# Syntax:
protected virtual void GenerateBinaryOperatorExpression(
   CodeBinaryOperatorExpression e
);
Parameters:

e

A CodeBinaryOperatorExpression that indicates the expression to generate code for.

See also:
CodeBinaryOperatorExpression

Return to top


Method: GenerateCastExpression(
   CodeCastExpression e
)
Summary
Generates code for the specified cast expression.
C# Syntax:
protected abstract void GenerateCastExpression(
   CodeCastExpression e
);
Parameters:

e

A CodeCastExpression that indicates the expression to generate code for.

See also:
CodeCastExpression

Return to top


Method: GenerateComment(
   CodeComment e
)
Summary
Generates code for the specified comment.
C# Syntax:
protected abstract void GenerateComment(
   CodeComment e
);
Parameters:

e

A CodeComment to generate code for.

See also:
CodeComment

Return to top


Method: GenerateCommentStatement(
   CodeCommentStatement e
)
Summary
Generates code for the specified comment statement.
C# Syntax:
protected virtual void GenerateCommentStatement(
   CodeCommentStatement e
);
Parameters:

e

A CodeCommentStatement that indicates the statement to generate code for.

See also:
CodeCommentStatement

Return to top


Method: GenerateCommentStatements(
   CodeCommentStatementCollection e
)
Summary
Generates code for the specified comment statements.
C# Syntax:
protected virtual void GenerateCommentStatements(
   CodeCommentStatementCollection e
);
Parameters:

e

A CodeCommentStatementCollection that indicates the expression to generate code for.

See also:
CodeCommentStatementCollection

Return to top


Method: GenerateCompileUnit(
   CodeCompileUnit e
)
Summary
Generates code for the specified compile unit.
C# Syntax:
protected virtual void GenerateCompileUnit(
   CodeCompileUnit e
);
Parameters:

e

A CodeCompileUnit that indicates the compile unit to generate code for.

See also:
CodeCompileUnit

Return to top


Method: GenerateCompileUnitEnd(
   CodeCompileUnit e
)
Summary
Generates code for the end of a compile unit.
C# Syntax:
protected virtual void GenerateCompileUnitEnd(
   CodeCompileUnit e
);
Parameters:

e

A CodeCompileUnit that indicates the compile unit to generate code for.

See also:
CodeCompileUnit

Return to top


Method: GenerateCompileUnitStart(
   CodeCompileUnit e
)
Summary
Generates code for the start of a compile unit.
C# Syntax:
protected virtual void GenerateCompileUnitStart(
   CodeCompileUnit e
);
Parameters:

e

A CodeCompileUnit that indicates the compile unit to generate code for.

See also:
CodeCompileUnit

Return to top


Method: GenerateConditionStatement(
   CodeConditionStatement e
)
Summary
Generates code for the specified conditional statement.
C# Syntax:
protected abstract void GenerateConditionStatement(
   CodeConditionStatement e
);
Parameters:

e

A CodeConditionStatement that indicates the statement to generate code for.

Remarks
For most languages, this method will generate code for an if statement.
See also:
CodeConditionStatement

Return to top


Method: GenerateConstructor(
   CodeConstructor e,
   CodeTypeDeclaration c
)
Summary
Generates code for the specified constructor.
C# Syntax:
protected abstract void GenerateConstructor(
   CodeConstructor e,
   CodeTypeDeclaration c
);
Parameters:

e

A CodeConstructor that indicates the constructor to generate code for.

c

A CodeTypeDeclaration that indicates the type of the object that this constructor constructs.

See also:
CodeConstructor | CodeTypeDeclaration

Return to top


Method: GenerateDecimalValue(
   decimal d
)
Summary
Generates code for the specified decimal value.
C# Syntax:
protected virtual void GenerateDecimalValue(
   decimal d
);
Parameters:

d

The decimal value to generate code for.

Return to top


Method: GenerateDelegateCreateExpression(
   CodeDelegateCreateExpression e
)
Summary
Generates code for the specified delegate creation expression.
C# Syntax:
protected abstract void GenerateDelegateCreateExpression(
   CodeDelegateCreateExpression e
);
Parameters:

e

A CodeDelegateCreateExpression that indicates the expression to generate code for.

See also:
CodeDelegateCreateExpression

Return to top


Method: GenerateDelegateInvokeExpression(
   CodeDelegateInvokeExpression e
)
Summary
Generates code for the specified delegate invoke expression.
C# Syntax:
protected abstract void GenerateDelegateInvokeExpression(
   CodeDelegateInvokeExpression e
);
Parameters:

e

A CodeDelegateInvokeExpression that indicates the expression to generate code for.

See also:
CodeDelegateInvokeExpression

Return to top


Method: GenerateDirectionExpression(
   CodeDirectionExpression e
)
Summary
Generates code for the specified direction expression.
C# Syntax:
protected virtual void GenerateDirectionExpression(
   CodeDirectionExpression e
);
Parameters:

e

A CodeDirectionExpression that indicates the expression to generate code for.

See also:
CodeDirectionExpression

Return to top


Method: GenerateDoubleValue(
   double d
)
Summary
Generates code for a double-precision floating point number.
C# Syntax:
protected virtual void GenerateDoubleValue(
   double d
);
Parameters:

d

The Double value to generate code for.

Return to top


Method: GenerateEntryPointMethod(
   CodeEntryPointMethod e,
   CodeTypeDeclaration c
)
Summary
Generates code for the specified entry point method.
C# Syntax:
protected abstract void GenerateEntryPointMethod(
   CodeEntryPointMethod e,
   CodeTypeDeclaration c
);
Parameters:

e

A CodeEntryPointMethod that indicates the entry point for the code.

c

A CodeTypeDeclaration that indicates the code that declares the type.

See also:
CodeEntryPointMethod | CodeTypeDeclaration

Return to top


Method: GenerateEvent(
   CodeMemberEvent e,
   CodeTypeDeclaration c
)
Summary
Generates code for the specified event.
C# Syntax:
protected abstract void GenerateEvent(
   CodeMemberEvent e,
   CodeTypeDeclaration c
);
Parameters:

e

A CodeMemberEvent that indicates the member event to generate code for.

c

A CodeTypeDeclaration that indicates the type of the object that this event occurs on.

See also:
CodeMemberEvent | CodeTypeDeclaration

Return to top


Method: GenerateEventReferenceExpression(
   CodeEventReferenceExpression e
)
Summary
Generates code for the specified event reference expression.
C# Syntax:
protected abstract void GenerateEventReferenceExpression(
   CodeEventReferenceExpression e
);
Parameters:

e

A CodeEventReferenceExpression that indicates the expression to generate code for.

See also:
CodeEventReferenceExpression

Return to top


Method: GenerateExpression(
   CodeExpression e
)
Summary
Generates code for the specified code expression.
C# Syntax:
protected void GenerateExpression(
   CodeExpression e
);
Parameters:

e

A CodeExpression that indicates the code expression to generate code for.

See also:
CodeExpression

Return to top


Method: GenerateExpressionStatement(
   CodeExpressionStatement e
)
Summary
Generates code for the specified expression statement.
C# Syntax:
protected abstract void GenerateExpressionStatement(
   CodeExpressionStatement e
);
Parameters:

e

A CodeExpressionStatement that indicates the statement to generate code for.

See also:
CodeExpressionStatement

Return to top


Method: GenerateField(
   CodeMemberField e
)
Summary
Generates code for the specified member field.
C# Syntax:
protected abstract void GenerateField(
   CodeMemberField e
);
Parameters:

e

A CodeMemberField that indicates the field to generate code for.

See also:
CodeMemberField

Return to top


Method: GenerateFieldReferenceExpression(
   CodeFieldReferenceExpression e
)
Summary
Generates code for the specified field reference expression.
C# Syntax:
protected abstract void GenerateFieldReferenceExpression(
   CodeFieldReferenceExpression e
);
Parameters:

e

A CodeFieldReferenceExpression that indicates the expression to generate code for.

See also:
CodeFieldReferenceExpression

Return to top


Method: GenerateGotoStatement(
   CodeGotoStatement e
)
Summary
Generates code for the specified goto statement.
C# Syntax:
protected abstract void GenerateGotoStatement(
   CodeGotoStatement e
);
Parameters:

e

A CodeGotoStatement that indicates the expression to generate code for.

See also:
CodeGotoStatement

Return to top


Method: GenerateIndexerExpression(
   CodeIndexerExpression e
)
Summary
Generates code for the specified indexer expression.
C# Syntax:
protected abstract void GenerateIndexerExpression(
   CodeIndexerExpression e
);
Parameters:

e

A CodeIndexerExpression that indicates the expression to generate code for.

See also:
CodeIndexerExpression

Return to top


Method: GenerateIterationStatement(
   CodeIterationStatement e
)
Summary
Generates code for the specified iteration statement.
C# Syntax:
protected abstract void GenerateIterationStatement(
   CodeIterationStatement e
);
Parameters:

e

A CodeIterationStatement that indicates the statement to generate code for.

Remarks
For most languages, this method will generate code for a for loop or a while loop.
See also:
CodeIterationStatement

Return to top


Method: GenerateLabeledStatement(
   CodeLabeledStatement e
)
Summary
Generates code for the specified labeled statement.
C# Syntax:
protected abstract void GenerateLabeledStatement(
   CodeLabeledStatement e
);
Parameters:

e

A CodeLabeledStatement that indicates the statement to generate code for.

See also:
CodeLabeledStatement

Return to top


Method: GenerateLinePragmaEnd(
   CodeLinePragma e
)
Summary
Generates code for the specified line pragma end.
C# Syntax:
protected abstract void GenerateLinePragmaEnd(
   CodeLinePragma e
);
Parameters:

e

A CodeLinePragma that indicates the end of the line pragma to generate code for.

See also:
CodeLinePragma

Return to top


Method: GenerateLinePragmaStart(
   CodeLinePragma e
)
Summary
Generates code for the specified line pragma start.
C# Syntax:
protected abstract void GenerateLinePragmaStart(
   CodeLinePragma e
);
Parameters:

e

A CodeLinePragma that indicates the start of the line pragma to generate code for.

See also:
CodeLinePragma

Return to top


Method: GenerateMethod(
   CodeMemberMethod e,
   CodeTypeDeclaration c
)
Summary
Generates code for the specified method.
C# Syntax:
protected abstract void GenerateMethod(
   CodeMemberMethod e,
   CodeTypeDeclaration c
);
Parameters:

e

A CodeMemberMethod that indicates the member method to generate code for.

c

A CodeTypeDeclaration that indicates the type of the object that this method occurs on.

See also:
CodeMemberMethod | CodeTypeDeclaration

Return to top


Method: GenerateMethodInvokeExpression(
   CodeMethodInvokeExpression e
)
Summary
Generates code for the specified method invoke expression.
C# Syntax:
protected abstract void GenerateMethodInvokeExpression(
   CodeMethodInvokeExpression e
);
Parameters:

e

A CodeMethodInvokeExpression that indicates the expression to generate code for.

See also:
CodeMethodInvokeExpression

Return to top


Method: GenerateMethodReferenceExpression(
   CodeMethodReferenceExpression e
)
Summary
Generates code for the specified method reference expression.
C# Syntax:
protected abstract void GenerateMethodReferenceExpression(
   CodeMethodReferenceExpression e
);
Parameters:

e

A CodeMethodReferenceExpression that indicates the expression to generate code for.

See also:
CodeMethodReferenceExpression

Return to top


Method: GenerateMethodReturnStatement(
   CodeMethodReturnStatement e
)
Summary
Generates code for the specified method return statement.
C# Syntax:
protected abstract void GenerateMethodReturnStatement(
   CodeMethodReturnStatement e
);
Parameters:

e

A CodeMethodReturnStatement that indicates the statement to generate code for.

See also:
CodeMethodReturnStatement

Return to top


Method: GenerateNamespace(
   CodeNamespace e
)
Summary
Generates code for the specified namespace.
C# Syntax:
protected virtual void GenerateNamespace(
   CodeNamespace e
);
Parameters:

e

A CodeNamespace that indicates the namespace to generate code for.

See also:
CodeNamespace

Return to top


Method: GenerateNamespaceEnd(
   CodeNamespace e
)
Summary
Generates code for the end of a namespace.
C# Syntax:
protected abstract void GenerateNamespaceEnd(
   CodeNamespace e
);
Parameters:

e

A CodeNamespace that indicates the namespace to generate code for.

See also:
CodeNamespace

Return to top


Method: GenerateNamespaceImport(
   CodeNamespaceImport e
)
Summary
Generates code for the specified namespace import.
C# Syntax:
protected abstract void GenerateNamespaceImport(
   CodeNamespaceImport e
);
Parameters:

e

A CodeNamespaceImport that indicates the namespace import to generate code for.

See also:
CodeNamespaceImport

Return to top


Method: GenerateNamespaceImports(
   CodeNamespace e
)
Summary
Generates code for the specified namespace import.
C# Syntax:
protected void GenerateNamespaceImports(
   CodeNamespace e
);
Parameters:

e

A CodeNamespace that indicates the namespace import to generate code for.

See also:
CodeNamespace

Return to top


Method: GenerateNamespaces(
   CodeCompileUnit e
)
Summary
Generates code for the namespaces in the specified compile unit.
C# Syntax:
protected void GenerateNamespaces(
   CodeCompileUnit e
);
Parameters:

e

A CodeCompileUnit that indicates the compile unit to generate namespaces for.

See also:
CodeCompileUnit

Return to top


Method: GenerateNamespaceStart(
   CodeNamespace e
)
Summary
Generates code for the start of a namespace.
C# Syntax:
protected abstract void GenerateNamespaceStart(
   CodeNamespace e
);
Parameters:

e

A CodeNamespace that indicates the namespace to generate code for.

See also:
CodeNamespace

Return to top


Method: GenerateObjectCreateExpression(
   CodeObjectCreateExpression e
)
Summary
Generates code for the specified object creation expression.
C# Syntax:
protected abstract void GenerateObjectCreateExpression(
   CodeObjectCreateExpression e
);
Parameters:

e

A CodeObjectCreateExpression that indicates the expression to generate code for.

See also:
CodeObjectCreateExpression

Return to top


Method: GenerateParameterDeclarationExpression(
   CodeParameterDeclarationExpression e
)
Summary
Generates code for the specified parameter declaration expression.
C# Syntax:
protected virtual void GenerateParameterDeclarationExpression(
   CodeParameterDeclarationExpression e
);
Parameters:

e

A CodeParameterDeclarationExpression that indicates the expression to generate code for.

See also:
CodeParameterDeclarationExpression

Return to top


Method: GeneratePrimitiveExpression(
   CodePrimitiveExpression e
)
Summary
Generates code for the specified primitive expression.
C# Syntax:
protected virtual void GeneratePrimitiveExpression(
   CodePrimitiveExpression e
);
Parameters:

e

A CodePrimitiveExpression that indicates the expression to generate code for.

See also:
CodePrimitiveExpression

Return to top


Method: GenerateProperty(
   CodeMemberProperty e,
   CodeTypeDeclaration c
)
Summary
Generates code for the specified property.
C# Syntax:
protected abstract void GenerateProperty(
   CodeMemberProperty e,
   CodeTypeDeclaration c
);
Parameters:

e

A CodeMemberProperty that indicates the property to generate code for.

c

A CodeTypeDeclaration that indicates the type of the object that this property occurs on.

See also:
CodeMemberProperty | CodeTypeDeclaration

Return to top


Method: GeneratePropertyReferenceExpression(
   CodePropertyReferenceExpression e
)
Summary
Generates code for the specified property reference expression.
C# Syntax:
protected abstract void GeneratePropertyReferenceExpression(
   CodePropertyReferenceExpression e
);
Parameters:

e

A CodePropertyReferenceExpression that indicates the expression to generate code for.

See also:
CodePropertyReferenceExpression

Return to top


Method: GeneratePropertySetValueReferenceExpression(
   CodePropertySetValueReferenceExpression e
)
Summary
Generates code for the specified property set value reference expression.
C# Syntax:
protected abstract void GeneratePropertySetValueReferenceExpression(
   CodePropertySetValueReferenceExpression e
);
Parameters:

e

A CodePropertySetValueReferenceExpression that indicates the expression to generate code for.

See also:
CodePropertySetValueReferenceExpression

Return to top


Method: GenerateRemoveEventStatement(
   CodeRemoveEventStatement e
)
Summary
Generates code for the specified remove event statement.
C# Syntax:
protected abstract void GenerateRemoveEventStatement(
   CodeRemoveEventStatement e
);
Parameters:

e

A CodeRemoveEventStatement that indicates the statement to generate code for.

See also:
CodeRemoveEventStatement

Return to top


Method: GenerateSingleFloatValue(
   float s
)
Summary
Generates code for a single-precision floating point number.
C# Syntax:
protected virtual void GenerateSingleFloatValue(
   float s
);
Parameters:

s

The Single value to generate code for.

Return to top


Method: GenerateSnippetCompileUnit(
   CodeSnippetCompileUnit e
)
Summary
Outputs the code of the specified literal code fragment compile unit.
C# Syntax:
protected virtual void GenerateSnippetCompileUnit(
   CodeSnippetCompileUnit e
);
Parameters:

e

A CodeSnippetCompileUnit that indicates the literal code fragment compile unit to generate code for.

See also:
CodeSnippetCompileUnit

Return to top


Method: GenerateSnippetExpression(
   CodeSnippetExpression e
)
Summary
Outputs the code of the specified literal code fragment expression.
C# Syntax:
protected abstract void GenerateSnippetExpression(
   CodeSnippetExpression e
);
Parameters:

e

A CodeSnippetExpression that indicates the expression to generate code for.

See also:
CodeSnippetExpression

Return to top


Method: GenerateSnippetMember(
   CodeSnippetTypeMember e
)
Summary
Outputs the code of the specified literal code fragment class member.
C# Syntax:
protected abstract void GenerateSnippetMember(
   CodeSnippetTypeMember e
);
Parameters:

e

A CodeSnippetTypeMember that indicates the member to generate code for.

See also:
CodeSnippetTypeMember

Return to top


Method: GenerateSnippetStatement(
   CodeSnippetStatement e
)
Summary
Outputs the code of the specified literal code fragment statement.
C# Syntax:
protected virtual void GenerateSnippetStatement(
   CodeSnippetStatement e
);
Parameters:

e

A CodeSnippetStatement that indicates the statement to generate code for.

See also:
CodeSnippetStatement

Return to top


Method: GenerateStatement(
   CodeStatement e
)
Summary
Generates code for the specified statement.
C# Syntax:
protected void GenerateStatement(
   CodeStatement e
);
Parameters:

e

A CodeStatement that indicates the statement to generate code for.

See also:
CodeStatement

Return to top


Method: GenerateStatements(
   CodeStatementCollection stms
)
Summary
Generates code for the specified statement collection.
C# Syntax:
protected void GenerateStatements(
   CodeStatementCollection stms
);
Parameters:

stms

A CodeStatementCollection that indicates the statements to generate code for.

See also:
CodeStatementCollection

Return to top


Method: GenerateThisReferenceExpression(
   CodeThisReferenceExpression e
)
Summary
Generates code for the specified this reference expression.
C# Syntax:
protected abstract void GenerateThisReferenceExpression(
   CodeThisReferenceExpression e
);
Parameters:

e

A CodeThisReferenceExpression that indicates the expression to generate code for.

See also:
CodeThisReferenceExpression

Return to top


Method: GenerateThrowExceptionStatement(
   CodeThrowExceptionStatement e
)
Summary
Generates code for the specified throw exception statement.
C# Syntax:
protected abstract void GenerateThrowExceptionStatement(
   CodeThrowExceptionStatement e
);
Parameters:

e

A CodeThrowExceptionStatement that indicates the statement to generate code for.

See also:
CodeThrowExceptionStatement

Return to top


Method: GenerateTryCatchFinallyStatement(
   CodeTryCatchFinallyStatement e
)
Summary
Generates code for the specified try...catch...finally statement.
C# Syntax:
protected abstract void GenerateTryCatchFinallyStatement(
   CodeTryCatchFinallyStatement e
);
Parameters:

e

A CodeTryCatchFinallyStatement that indicates the statement to generate code for.

See also:
CodeTryCatchFinallyStatement

Return to top


Method: GenerateTypeConstructor(
   CodeTypeConstructor e
)
Summary
Generates code for the specified class constructor.
C# Syntax:
protected abstract void GenerateTypeConstructor(
   CodeTypeConstructor e
);
Parameters:

e

A CodeTypeConstructor that indicates the class constructor to generate code for.

See also:
CodeTypeConstructor

Return to top


Method: GenerateTypeEnd(
   CodeTypeDeclaration e
)
Summary
Generates code for the specified end class.
C# Syntax:
protected abstract void GenerateTypeEnd(
   CodeTypeDeclaration e
);
Parameters:

e

A CodeTypeDeclaration that indicates the end of the class to generate code for.

See also:
CodeTypeDeclaration

Return to top


Method: GenerateTypeOfExpression(
   CodeTypeOfExpression e
)
Summary
Generates code for the specified type of expression.
C# Syntax:
protected virtual void GenerateTypeOfExpression(
   CodeTypeOfExpression e
);
Parameters:

e

A CodeTypeOfExpression that indicates the expression to generate code for.

See also:
CodeTypeOfExpression

Return to top


Method: GenerateTypeReferenceExpression(
   CodeTypeReferenceExpression e
)
Summary
Generates code for the specified type reference expression.
C# Syntax:
protected virtual void GenerateTypeReferenceExpression(
   CodeTypeReferenceExpression e
);
Parameters:

e

A CodeTypeReferenceExpression that indicates the expression to generate code for.

See also:
CodeTypeReferenceExpression

Return to top


Method: GenerateTypes(
   CodeNamespace e
)
Summary
Generates code for the specified namespace and the classes it contains.
C# Syntax:
protected void GenerateTypes(
   CodeNamespace e
);
Parameters:

e

A CodeNamespace that indicates the namespace to generate classes for.

See also:
CodeNamespace

Return to top


Method: GenerateTypeStart(
   CodeTypeDeclaration e
)
Summary
Generates code for the specified start class.
C# Syntax:
protected abstract void GenerateTypeStart(
   CodeTypeDeclaration e
);
Parameters:

e

A CodeTypeDeclaration that indicates the start of the class to generate code for.

See also:
CodeTypeDeclaration

Return to top


Method: GenerateVariableDeclarationStatement(
   CodeVariableDeclarationStatement e
)
Summary
Generates code for the specified variable declaration statement.
C# Syntax:
protected abstract void GenerateVariableDeclarationStatement(
   CodeVariableDeclarationStatement e
);
Parameters:

e

A CodeVariableDeclarationStatement that indicates the statement to generate code for.

See also:
CodeVariableDeclarationStatement

Return to top


Method: GenerateVariableReferenceExpression(
   CodeVariableReferenceExpression e
)
Summary
Generates code for the specified variable reference expression.
C# Syntax:
protected abstract void GenerateVariableReferenceExpression(
   CodeVariableReferenceExpression e
);
Parameters:

e

A CodeVariableReferenceExpression that indicates the expression to generate code for.

See also:
CodeVariableReferenceExpression

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetTypeOutput(
   CodeTypeReference value
)
Summary
Gets the name of the specified data type.
C# Syntax:
protected abstract string GetTypeOutput(
   CodeTypeReference value
);
Parameters:

value

A CodeTypeReference of the type to return the name of.

Return Value:
The name of the data type reference.
See also:
CodeTypeReference

Return to top


Method: IsValidIdentifier(
   string value
)
Summary
Gets a value indicating whether the specified value is a valid identifier.
C# Syntax:
protected abstract bool IsValidIdentifier(
   string value
);
Parameters:

value

The value to test for conflicts with valid identifiers.

Return Value:
true if the value is a valid identifer; otherwise, false.

Return to top


Method: IsValidLanguageIndependentIdentifier(
   string value
)
Summary
Gets a value indicating whether the specified value is a valid language-independent identifier.
C# Syntax:
public static bool IsValidLanguageIndependentIdentifier(
   string value
);
Parameters:

value

The string to test for validity.

Return Value:
true if the specified value is valid; otherwise, false.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: OutputAttributeArgument(
   CodeAttributeArgument arg
)
Summary
Outputs an argument in an attribute block.
C# Syntax:
protected virtual void OutputAttributeArgument(
   CodeAttributeArgument arg
);
Parameters:

arg

A CodeAttributeArgument that indicates the attribute argument to generate code for.

See also:
CodeAttributeArgument

Return to top


Method: OutputAttributeDeclarations(
   CodeAttributeDeclarationCollection attributes
)
Summary
Generates code for the specified attribute declaration collection.
C# Syntax:
protected virtual void OutputAttributeDeclarations(
   CodeAttributeDeclarationCollection attributes
);
Parameters:

attributes

A CodeAttributeDeclarationCollection that indicates the attributes to generate code for.

See also:
CodeAttributeDeclarationCollection

Return to top


Method: OutputDirection(
   FieldDirection dir
)
Summary
Generates code for the specified FieldDirection.
C# Syntax:
protected virtual void OutputDirection(
   FieldDirection dir
);
Parameters:

dir

A FieldDirection enumeration value indicating the attribute of the field.

See also:
FieldDirection

Return to top


Overloaded Method: OutputExpressionList(
   CodeExpressionCollection expressions
)
Summary
Generates code for the specified expression list.
C# Syntax:
protected virtual void OutputExpressionList(
   CodeExpressionCollection expressions
);
Parameters:

expressions

A CodeExpressionCollection that indicates the expressions to generate code for.

See also:
CodeExpressionCollection

Return to top


Overloaded Method: OutputExpressionList(
   CodeExpressionCollection expressions,
   bool newlineBetweenItems
)
Summary
Generates code for the specified expression list.
C# Syntax:
protected virtual void OutputExpressionList(
   CodeExpressionCollection expressions,
   bool newlineBetweenItems
);
Parameters:

expressions

A CodeExpressionCollection that indicates the expressions to generate code for.

newlineBetweenItems

true to insert a new line after each item; otherwise, false.

See also:
CodeExpressionCollection

Return to top


Method: OutputFieldScopeModifier(
   MemberAttributes attributes
)
Summary
Outputs a field scope modifier that corresponds to the specified attributes.
C# Syntax:
protected virtual void OutputFieldScopeModifier(
   MemberAttributes attributes
);
Parameters:

attributes

A MemberAttributes enumeration value indicating the attributes.

See also:
MemberAttributes

Return to top


Method: OutputIdentifier(
   string ident
)
Summary
Outputs the specified identifier.
C# Syntax:
protected virtual void OutputIdentifier(
   string ident
);
Parameters:

ident

The identifier to output.

Return to top


Method: OutputMemberAccessModifier(
   MemberAttributes attributes
)
Summary
Generates code for the specified member access modifier.
C# Syntax:
protected virtual void OutputMemberAccessModifier(
   MemberAttributes attributes
);
Parameters:

attributes

A MemberAttributes enumeration value indicating the member access modifier to generate code for.

See also:
MemberAttributes

Return to top


Method: OutputMemberScopeModifier(
   MemberAttributes attributes
)
Summary
Generates code for the specified member scope modifier.
C# Syntax:
protected virtual void OutputMemberScopeModifier(
   MemberAttributes attributes
);
Parameters:

attributes

A MemberAttributes enumeration value indicating the member scope modifier to generate code for.

See also:
MemberAttributes

Return to top


Method: OutputOperator(
   CodeBinaryOperatorType op
)
Summary
Generates code for the specified operator.
C# Syntax:
protected virtual void OutputOperator(
   CodeBinaryOperatorType op
);
Parameters:

op

A CodeBinaryOperatorType that indicates the operator to generate code for.

See also:
CodeBinaryOperatorType

Return to top


Method: OutputParameters(
   CodeParameterDeclarationExpressionCollection parameters
)
Summary
Generates code for the specified parameters.
C# Syntax:
protected virtual void OutputParameters(
   CodeParameterDeclarationExpressionCollection parameters
);
Parameters:

parameters

A CodeParameterDeclarationExpressionCollection that indicates the parameter declaration expressions to generate code for.

See also:
CodeParameterDeclarationExpressionCollection

Return to top


Method: OutputType(
   CodeTypeReference typeRef
)
Summary
Generates code for the specified type.
C# Syntax:
protected abstract void OutputType(
   CodeTypeReference typeRef
);
Parameters:

typeRef

The type to generate code for.

Return to top


Method: OutputTypeAttributes(
   TypeAttributes attributes,
   bool isStruct,
   bool isEnum
)
Summary
Generates code for the specified type attributes.
C# Syntax:
protected virtual void OutputTypeAttributes(
   TypeAttributes attributes,
   bool isStruct,
   bool isEnum
);
Parameters:

attributes

A TypeAttributes enumeration value indicating the type attributes to generate code for.

isStruct

true if the type is a struct; otherwise, false.

isEnum

true if the type is an enum; otherwise, false.

See also:
TypeAttributes

Return to top


Method: OutputTypeNamePair(
   CodeTypeReference typeRef,
   string name
)
Summary
Generates code for the specified object type and name pair.
C# Syntax:
protected virtual void OutputTypeNamePair(
   CodeTypeReference typeRef,
   string name
);
Parameters:

typeRef

The type.

name

The name for the object.

Return to top


Method: QuoteSnippetString(
   string value
)
Summary
Converts the specified string by formatting it with escape codes.
C# Syntax:
protected abstract string QuoteSnippetString(
   string value
);
Parameters:

value

The string to convert.

Return Value:
The converted string.
Remarks
This method returns a modified version of the specified string that has been formatted with escape code characters. For example, /" might be used to represent " . These escape codes are used to replace elements of the specified string that might otherwise conflict with language syntax.

Return to top


Method: Supports(
   GeneratorSupport support
)
Summary
Gets a value indicating whether the specified code generation support is provided.
C# Syntax:
protected abstract bool Supports(
   GeneratorSupport support
);
Parameters:

support

A GeneratorSupport that indicates the type of code generation support to test for.

Return Value:
true if the specified code generation support is provided; otherwise, false.
See also:
GeneratorSupport

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: ValidateIdentifier(
   string value
)
Summary
Throws an exception if the specified value is not a valid identifier.
C# Syntax:
protected virtual void ValidateIdentifier(
   string value
);
Parameters:

value

The identifier to test for validity as an identifier.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.