TechNet
Export (0) Print
Expand All

ICodeGenerator Interface

 

Defines an interface for generating code.

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

public interface ICodeGenerator

NameDescription
System_CAPS_pubmethodCreateEscapedIdentifier(String)

Creates an escaped identifier for the specified value.

System_CAPS_pubmethodCreateValidIdentifier(String)

Creates a valid identifier for the specified value.

System_CAPS_pubmethodGenerateCodeFromCompileUnit(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.

System_CAPS_pubmethodGenerateCodeFromExpression(CodeExpression, TextWriter, CodeGeneratorOptions)

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

System_CAPS_pubmethodGenerateCodeFromNamespace(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.

System_CAPS_pubmethodGenerateCodeFromStatement(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.

System_CAPS_pubmethodGenerateCodeFromType(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.

System_CAPS_pubmethodGetTypeOutput(CodeTypeReference)

Gets the type indicated by the specified CodeTypeReference.

System_CAPS_pubmethodIsValidIdentifier(String)

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

System_CAPS_pubmethodSupports(GeneratorSupport)

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

System_CAPS_pubmethodValidateIdentifier(String)

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

System_CAPS_noteNote

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.

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft