ICodeGenerator Interface
Defines an interface for generating code.
Assembly: System (in System.dll)
The ICodeGenerator type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | CreateEscapedIdentifier | Creates an escaped identifier for the specified value. |
![]() | CreateValidIdentifier | Creates a valid identifier for the specified value. |
![]() | GenerateCodeFromCompileUnit | 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 | Generates code for the specified Code Document Object Model (CodeDOM) expression and outputs it to the specified text writer. |
![]() | GenerateCodeFromNamespace | Generates code for the specified Code Document Object Model (CodeDOM) namespace and outputs it to the specified text writer using the specified options. |
![]() | GenerateCodeFromStatement | Generates code for the specified Code Document Object Model (CodeDOM) statement and outputs it to the specified text writer using the specified options. |
![]() | GenerateCodeFromType | 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 | Gets the type indicated by the specified CodeTypeReference. |
![]() | IsValidIdentifier | Gets a value that indicates whether the specified value is a valid identifier for the current language. |
![]() | Supports | Gets a value indicating whether the generator provides support for the language features represented by the specified GeneratorSupport object. |
![]() | ValidateIdentifier | Throws an exception if the specified value is not a valid identifier. |
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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
