CodeGenerator Class

CodeGenerator Class

 

Provides an example implementation of the ICodeGenerator interface. This class is abstract.

Namespace:   System.CodeDom.Compiler
Assembly:  System (in System.dll)

System.Object
  System.CodeDom.Compiler.CodeGenerator
    System.CodeDom.Compiler.CodeCompiler

[PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public abstract class CodeGenerator : ICodeGenerator

NameDescription
System_CAPS_protmethodCodeGenerator()

Initializes a new instance of the CodeGenerator class.

NameDescription
System_CAPS_protpropertyCurrentClass

Gets the code type declaration for the current class.

System_CAPS_protpropertyCurrentMember

Gets the current member of the class.

System_CAPS_protpropertyCurrentMemberName

Gets the current member name.

System_CAPS_protpropertyCurrentTypeName

Gets the current class name.

System_CAPS_protpropertyIndent

Gets or sets the amount of spaces to indent each indentation level.

System_CAPS_protpropertyIsCurrentClass

Gets a value indicating whether the current object being generated is a class.

System_CAPS_protpropertyIsCurrentDelegate

Gets a value indicating whether the current object being generated is a delegate.

System_CAPS_protpropertyIsCurrentEnum

Gets a value indicating whether the current object being generated is an enumeration.

System_CAPS_protpropertyIsCurrentInterface

Gets a value indicating whether the current object being generated is an interface.

System_CAPS_protpropertyIsCurrentStruct

Gets a value indicating whether the current object being generated is a value type or struct.

System_CAPS_protpropertyNullToken

Gets the token that represents null.

System_CAPS_protpropertyOptions

Gets the options to be used by the code generator.

System_CAPS_protpropertyOutput

Gets the text writer to use for output.

NameDescription
System_CAPS_protmethodContinueOnNewLine(String)

Generates a line-continuation character and outputs the specified string on a new line.

System_CAPS_protmethodCreateEscapedIdentifier(String)

Creates an escaped identifier for the specified value.

System_CAPS_protmethodCreateValidIdentifier(String)

Creates a valid identifier for the specified value.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_protmethodGenerateArgumentReferenceExpression(CodeArgumentReferenceExpression)

Generates code for the specified argument reference expression.

System_CAPS_protmethodGenerateArrayCreateExpression(CodeArrayCreateExpression)

Generates code for the specified array creation expression.

System_CAPS_protmethodGenerateArrayIndexerExpression(CodeArrayIndexerExpression)

Generates code for the specified array indexer expression.

System_CAPS_protmethodGenerateAssignStatement(CodeAssignStatement)

Generates code for the specified assignment statement.

System_CAPS_protmethodGenerateAttachEventStatement(CodeAttachEventStatement)

Generates code for the specified attach event statement.

System_CAPS_protmethodGenerateAttributeDeclarationsEnd(CodeAttributeDeclarationCollection)

Generates code for the specified attribute block end.

System_CAPS_protmethodGenerateAttributeDeclarationsStart(CodeAttributeDeclarationCollection)

Generates code for the specified attribute block start.

System_CAPS_protmethodGenerateBaseReferenceExpression(CodeBaseReferenceExpression)

Generates code for the specified base reference expression.

System_CAPS_protmethodGenerateBinaryOperatorExpression(CodeBinaryOperatorExpression)

Generates code for the specified binary operator expression.

System_CAPS_protmethodGenerateCastExpression(CodeCastExpression)

Generates code for the specified cast expression.

System_CAPS_pubmethodGenerateCodeFromMember(CodeTypeMember, TextWriter, CodeGeneratorOptions)

Generates code for the specified class member using the specified text writer and code generator options.

System_CAPS_protmethodGenerateComment(CodeComment)

Generates code for the specified comment.

System_CAPS_protmethodGenerateCommentStatement(CodeCommentStatement)

Generates code for the specified comment statement.

System_CAPS_protmethodGenerateCommentStatements(CodeCommentStatementCollection)

Generates code for the specified comment statements.

System_CAPS_protmethodGenerateCompileUnit(CodeCompileUnit)

Generates code for the specified compile unit.

System_CAPS_protmethodGenerateCompileUnitEnd(CodeCompileUnit)

Generates code for the end of a compile unit.

System_CAPS_protmethodGenerateCompileUnitStart(CodeCompileUnit)

Generates code for the start of a compile unit.

System_CAPS_protmethodGenerateConditionStatement(CodeConditionStatement)

Generates code for the specified conditional statement.

System_CAPS_protmethodGenerateConstructor(CodeConstructor, CodeTypeDeclaration)

Generates code for the specified constructor.

System_CAPS_protmethodGenerateDecimalValue(Decimal)

Generates code for the specified decimal value.

System_CAPS_protmethodGenerateDefaultValueExpression(CodeDefaultValueExpression)

Generates code for the specified reference to a default value.

System_CAPS_protmethodGenerateDelegateCreateExpression(CodeDelegateCreateExpression)

Generates code for the specified delegate creation expression.

System_CAPS_protmethodGenerateDelegateInvokeExpression(CodeDelegateInvokeExpression)

Generates code for the specified delegate invoke expression.

System_CAPS_protmethodGenerateDirectionExpression(CodeDirectionExpression)

Generates code for the specified direction expression.

System_CAPS_protmethodGenerateDirectives(CodeDirectiveCollection)

Generates code for the specified code directives.

System_CAPS_protmethodGenerateDoubleValue(Double)

Generates code for a double-precision floating point number.

System_CAPS_protmethodGenerateEntryPointMethod(CodeEntryPointMethod, CodeTypeDeclaration)

Generates code for the specified entry point method.

System_CAPS_protmethodGenerateEvent(CodeMemberEvent, CodeTypeDeclaration)

Generates code for the specified event.

System_CAPS_protmethodGenerateEventReferenceExpression(CodeEventReferenceExpression)

Generates code for the specified event reference expression.

System_CAPS_protmethodGenerateExpression(CodeExpression)

Generates code for the specified code expression.

System_CAPS_protmethodGenerateExpressionStatement(CodeExpressionStatement)

Generates code for the specified expression statement.

System_CAPS_protmethodGenerateField(CodeMemberField)

Generates code for the specified member field.

System_CAPS_protmethodGenerateFieldReferenceExpression(CodeFieldReferenceExpression)

Generates code for the specified field reference expression.

System_CAPS_protmethodGenerateGotoStatement(CodeGotoStatement)

Generates code for the specified goto statement.

System_CAPS_protmethodGenerateIndexerExpression(CodeIndexerExpression)

Generates code for the specified indexer expression.

System_CAPS_protmethodGenerateIterationStatement(CodeIterationStatement)

Generates code for the specified iteration statement.

System_CAPS_protmethodGenerateLabeledStatement(CodeLabeledStatement)

Generates code for the specified labeled statement.

System_CAPS_protmethodGenerateLinePragmaEnd(CodeLinePragma)

Generates code for the specified line pragma end.

System_CAPS_protmethodGenerateLinePragmaStart(CodeLinePragma)

Generates code for the specified line pragma start.

System_CAPS_protmethodGenerateMethod(CodeMemberMethod, CodeTypeDeclaration)

Generates code for the specified method.

System_CAPS_protmethodGenerateMethodInvokeExpression(CodeMethodInvokeExpression)

Generates code for the specified method invoke expression.

System_CAPS_protmethodGenerateMethodReferenceExpression(CodeMethodReferenceExpression)

Generates code for the specified method reference expression.

System_CAPS_protmethodGenerateMethodReturnStatement(CodeMethodReturnStatement)

Generates code for the specified method return statement.

System_CAPS_protmethodGenerateNamespace(CodeNamespace)

Generates code for the specified namespace.

System_CAPS_protmethodGenerateNamespaceEnd(CodeNamespace)

Generates code for the end of a namespace.

System_CAPS_protmethodGenerateNamespaceImport(CodeNamespaceImport)

Generates code for the specified namespace import.

System_CAPS_protmethodGenerateNamespaceImports(CodeNamespace)

Generates code for the specified namespace import.

System_CAPS_protmethodGenerateNamespaces(CodeCompileUnit)

Generates code for the namespaces in the specified compile unit.

System_CAPS_protmethodGenerateNamespaceStart(CodeNamespace)

Generates code for the start of a namespace.

System_CAPS_protmethodGenerateObjectCreateExpression(CodeObjectCreateExpression)

Generates code for the specified object creation expression.

System_CAPS_protmethodGenerateParameterDeclarationExpression(CodeParameterDeclarationExpression)

Generates code for the specified parameter declaration expression.

System_CAPS_protmethodGeneratePrimitiveExpression(CodePrimitiveExpression)

Generates code for the specified primitive expression.

System_CAPS_protmethodGenerateProperty(CodeMemberProperty, CodeTypeDeclaration)

Generates code for the specified property.

System_CAPS_protmethodGeneratePropertyReferenceExpression(CodePropertyReferenceExpression)

Generates code for the specified property reference expression.

System_CAPS_protmethodGeneratePropertySetValueReferenceExpression(CodePropertySetValueReferenceExpression)

Generates code for the specified property set value reference expression.

System_CAPS_protmethodGenerateRemoveEventStatement(CodeRemoveEventStatement)

Generates code for the specified remove event statement.

System_CAPS_protmethodGenerateSingleFloatValue(Single)

Generates code for a single-precision floating point number.

System_CAPS_protmethodGenerateSnippetCompileUnit(CodeSnippetCompileUnit)

Outputs the code of the specified literal code fragment compile unit.

System_CAPS_protmethodGenerateSnippetExpression(CodeSnippetExpression)

Outputs the code of the specified literal code fragment expression.

System_CAPS_protmethodGenerateSnippetMember(CodeSnippetTypeMember)

Outputs the code of the specified literal code fragment class member.

System_CAPS_protmethodGenerateSnippetStatement(CodeSnippetStatement)

Outputs the code of the specified literal code fragment statement.

System_CAPS_protmethodGenerateStatement(CodeStatement)

Generates code for the specified statement.

System_CAPS_protmethodGenerateStatements(CodeStatementCollection)

Generates code for the specified statement collection.

System_CAPS_protmethodGenerateThisReferenceExpression(CodeThisReferenceExpression)

Generates code for the specified this reference expression.

System_CAPS_protmethodGenerateThrowExceptionStatement(CodeThrowExceptionStatement)

Generates code for the specified throw exception statement.

System_CAPS_protmethodGenerateTryCatchFinallyStatement(CodeTryCatchFinallyStatement)

Generates code for the specified try...catch...finally statement.

System_CAPS_protmethodGenerateTypeConstructor(CodeTypeConstructor)

Generates code for the specified class constructor.

System_CAPS_protmethodGenerateTypeEnd(CodeTypeDeclaration)

Generates code for the specified end of the class.

System_CAPS_protmethodGenerateTypeOfExpression(CodeTypeOfExpression)

Generates code for the specified type of expression.

System_CAPS_protmethodGenerateTypeReferenceExpression(CodeTypeReferenceExpression)

Generates code for the specified type reference expression.

System_CAPS_protmethodGenerateTypes(CodeNamespace)

Generates code for the specified namespace and the classes it contains.

System_CAPS_protmethodGenerateTypeStart(CodeTypeDeclaration)

Generates code for the specified start of the class.

System_CAPS_protmethodGenerateVariableDeclarationStatement(CodeVariableDeclarationStatement)

Generates code for the specified variable declaration statement.

System_CAPS_protmethodGenerateVariableReferenceExpression(CodeVariableReferenceExpression)

Generates code for the specified variable reference expression.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodGetTypeOutput(CodeTypeReference)

Gets the name of the specified data type.

System_CAPS_protmethodIsValidIdentifier(String)

Gets a value indicating whether the specified value is a valid identifier.

System_CAPS_pubmethodSystem_CAPS_staticIsValidLanguageIndependentIdentifier(String)

Gets a value indicating whether the specified string is a valid identifier.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOutputAttributeArgument(CodeAttributeArgument)

Outputs an argument in an attribute block.

System_CAPS_protmethodOutputAttributeDeclarations(CodeAttributeDeclarationCollection)

Generates code for the specified attribute declaration collection.

System_CAPS_protmethodOutputDirection(FieldDirection)

Generates code for the specified FieldDirection.

System_CAPS_protmethodOutputExpressionList(CodeExpressionCollection)

Generates code for the specified expression list.

System_CAPS_protmethodOutputExpressionList(CodeExpressionCollection, Boolean)

Generates code for the specified expression list.

System_CAPS_protmethodOutputFieldScopeModifier(MemberAttributes)

Outputs a field scope modifier that corresponds to the specified attributes.

System_CAPS_protmethodOutputIdentifier(String)

Outputs the specified identifier.

System_CAPS_protmethodOutputMemberAccessModifier(MemberAttributes)

Generates code for the specified member access modifier.

System_CAPS_protmethodOutputMemberScopeModifier(MemberAttributes)

Generates code for the specified member scope modifier.

System_CAPS_protmethodOutputOperator(CodeBinaryOperatorType)

Generates code for the specified operator.

System_CAPS_protmethodOutputParameters(CodeParameterDeclarationExpressionCollection)

Generates code for the specified parameters.

System_CAPS_protmethodOutputType(CodeTypeReference)

Generates code for the specified type.

System_CAPS_protmethodOutputTypeAttributes(TypeAttributes, Boolean, Boolean)

Generates code for the specified type attributes.

System_CAPS_protmethodOutputTypeNamePair(CodeTypeReference, String)

Generates code for the specified object type and name pair.

System_CAPS_protmethodQuoteSnippetString(String)

Converts the specified string by formatting it with escape codes.

System_CAPS_protmethodSupports(GeneratorSupport)

Gets a value indicating whether the specified code generation support is provided.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_protmethodValidateIdentifier(String)

Throws an exception if the specified string is not a valid identifier.

System_CAPS_pubmethodSystem_CAPS_staticValidateIdentifiers(CodeObject)

Attempts to validate each identifier field contained in the specified CodeObject or System.CodeDom tree.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.CreateEscapedIdentifier(String)

This API supports the product infrastructure and is not intended to be used directly from your code. Creates an escaped identifier for the specified value.

System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.CreateValidIdentifier(String)

This API supports the product infrastructure and is not intended to be used directly from your code. Creates a valid identifier for the specified value.

System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.GenerateCodeFromCompileUnit(CodeCompileUnit, TextWriter, CodeGeneratorOptions)

This API supports the product infrastructure and is not intended to be used directly from your code. Generates code for the specified Code Document Object Model (CodeDOM) compilation unit and outputs it to the specified text writer using the specified options.

System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.GenerateCodeFromExpression(CodeExpression, TextWriter, CodeGeneratorOptions)

This API supports the product infrastructure and is not intended to be used directly from your code. Generates code for the specified Code Document Object Model (CodeDOM) expression and outputs it to the specified text writer.

System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.GenerateCodeFromNamespace(CodeNamespace, TextWriter, CodeGeneratorOptions)

This API supports the product infrastructure and is not intended to be used directly from your code. Generates code for the specified Code Document Object Model (CodeDOM) namespace and outputs it to the specified text writer using the specified options.

System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.GenerateCodeFromStatement(CodeStatement, TextWriter, CodeGeneratorOptions)

This API supports the product infrastructure and is not intended to be used directly from your code. Generates code for the specified Code Document Object Model (CodeDOM) statement and outputs it to the specified text writer using the specified options.

System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.GenerateCodeFromType(CodeTypeDeclaration, TextWriter, CodeGeneratorOptions)

This API supports the product infrastructure and is not intended to be used directly from your code. Generates code for the specified Code Document Object Model (CodeDOM) type declaration and outputs it to the specified text writer using the specified options.

System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.GetTypeOutput(CodeTypeReference)

This API supports the product infrastructure and is not intended to be used directly from your code. Gets the type indicated by the specified CodeTypeReference.

System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.IsValidIdentifier(String)

This API supports the product infrastructure and is not intended to be used directly from your code. Gets a value that indicates whether the specified value is a valid identifier for the current language.

System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.Supports(GeneratorSupport)

This API supports the product infrastructure and is not intended to be used directly from your code. Gets a value indicating whether the generator provides support for the language features represented by the specified GeneratorSupport object.

System_CAPS_pubinterfaceSystem_CAPS_privmethodICodeGenerator.ValidateIdentifier(String)

This API supports the product infrastructure and is not intended to be used directly from your code. Throws an exception if the specified value is not a valid identifier.

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.

System_CAPS_noteNote

This class contains a link demand and an inheritance demand at the class level that applies to all members. A SecurityException is thrown when either the immediate caller or the derived class does not have full-trust permission. For details about security demands, see Link Demands and Inheritance Demands.

SecurityAction.LinkDemand

for full trust for the immediate caller. This class cannot be used by partially trusted code.

SecurityAction.InheritanceDemand

for full trust for inheritors. This class cannot be inherited by partially trusted code.

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft