Bearbeiten

Freigeben über


ICodeGenerator Interface

Definition

Defines an interface for generating code.

public interface class ICodeGenerator
public interface ICodeGenerator
type ICodeGenerator = interface
Public Interface ICodeGenerator
Derived

Remarks

Note

In the .NET Framework versions 1.0 and 1.1, code providers consist of implementations of CodeDomProvider, ICodeGenerator, ICodeParser, and ICodeCompiler. In the .NET Framework 2.0, the CreateGenerator, CreateParser, and CreateCompiler methods are obsolete, and the methods of ICodeGenerator and ICodeCompiler are directly available in the CodeDomProvider class. You should override those methods in your code provider implementation and not call the base methods.

Developers of compilers can implement this interface to allow people to dynamically generate code in a particular language. This can be used for a variety of purposes, such as creating code-generating wizards, creating dynamic assemblies with content that can be debugged, and for templated documents with embedded code, such as ASP.NET.

An ICodeGenerator implementation is typically obtained through a call to the CreateGenerator method of CodeDomProvider.

Methods

CreateEscapedIdentifier(String)

Creates an escaped identifier for the specified value.

CreateValidIdentifier(String)

Creates a valid identifier for the specified value.

GenerateCodeFromCompileUnit(CodeCompileUnit, TextWriter, CodeGeneratorOptions)

Generates code for the specified Code Document Object Model (CodeDOM) compilation unit and outputs it to the specified text writer using the specified options.

GenerateCodeFromExpression(CodeExpression, TextWriter, CodeGeneratorOptions)

Generates code for the specified Code Document Object Model (CodeDOM) expression and outputs it to the specified text writer.

GenerateCodeFromNamespace(CodeNamespace, TextWriter, CodeGeneratorOptions)

Generates code for the specified Code Document Object Model (CodeDOM) namespace and outputs it to the specified text writer using the specified options.

GenerateCodeFromStatement(CodeStatement, TextWriter, CodeGeneratorOptions)

Generates code for the specified Code Document Object Model (CodeDOM) statement and outputs it to the specified text writer using the specified options.

GenerateCodeFromType(CodeTypeDeclaration, TextWriter, CodeGeneratorOptions)

Generates code for the specified Code Document Object Model (CodeDOM) type declaration and outputs it to the specified text writer using the specified options.

GetTypeOutput(CodeTypeReference)

Gets the type indicated by the specified CodeTypeReference.

IsValidIdentifier(String)

Gets a value that indicates whether the specified value is a valid identifier for the current language.

Supports(GeneratorSupport)

Gets a value indicating whether the generator provides support for the language features represented by the specified GeneratorSupport object.

ValidateIdentifier(String)

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

Applies to