編輯

共用方式為


CodeDomProvider.CreateGenerator Method

Definition

When overridden in a derived class, creates a new code generator.

Overloads

CreateGenerator()
Obsolete.
Obsolete.

When overridden in a derived class, creates a new code generator.

CreateGenerator(TextWriter)

When overridden in a derived class, creates a new code generator using the specified TextWriter for output.

CreateGenerator(String)

When overridden in a derived class, creates a new code generator using the specified file name for output.

CreateGenerator()

Source:
CodeDomProvider.cs
Source:
CodeDomProvider.cs
Source:
CodeDomProvider.cs
Source:
CodeDomProvider.cs

Caution

ICodeGenerator has been deprecated. Use the methods directly on the CodeDomProvider class instead. Classes inheriting from CodeDomProvider must still implement this interface, and should suppress this warning or also mark this method as obsolete.

Caution

Callers should not use the ICodeGenerator interface and should instead use the methods directly on the CodeDomProvider class. Those inheriting from CodeDomProvider must still implement this interface, and should exclude this warning or also obsolete this method.

When overridden in a derived class, creates a new code generator.

public:
 abstract System::CodeDom::Compiler::ICodeGenerator ^ CreateGenerator();
[System.Obsolete("ICodeGenerator has been deprecated. Use the methods directly on the CodeDomProvider class instead. Classes inheriting from CodeDomProvider must still implement this interface, and should suppress this warning or also mark this method as obsolete.")]
public abstract System.CodeDom.Compiler.ICodeGenerator CreateGenerator ();
public abstract System.CodeDom.Compiler.ICodeGenerator CreateGenerator ();
[System.Obsolete("Callers should not use the ICodeGenerator interface and should instead use the methods directly on the CodeDomProvider class. Those inheriting from CodeDomProvider must still implement this interface, and should exclude this warning or also obsolete this method.")]
public abstract System.CodeDom.Compiler.ICodeGenerator CreateGenerator ();
[<System.Obsolete("ICodeGenerator has been deprecated. Use the methods directly on the CodeDomProvider class instead. Classes inheriting from CodeDomProvider must still implement this interface, and should suppress this warning or also mark this method as obsolete.")>]
abstract member CreateGenerator : unit -> System.CodeDom.Compiler.ICodeGenerator
abstract member CreateGenerator : unit -> System.CodeDom.Compiler.ICodeGenerator
[<System.Obsolete("Callers should not use the ICodeGenerator interface and should instead use the methods directly on the CodeDomProvider class. Those inheriting from CodeDomProvider must still implement this interface, and should exclude this warning or also obsolete this method.")>]
abstract member CreateGenerator : unit -> System.CodeDom.Compiler.ICodeGenerator
Public MustOverride Function CreateGenerator () As ICodeGenerator

Returns

An ICodeGenerator that can be used to generate System.CodeDom based source code representations.

Attributes

Remarks

This method is obsolete in the .NET Framework 2.0. The recommended alternative is to call the ICodeGenerator methods that are directly available in the CodeDomProvider class.

Notes to Implementers

In the .NET Framework 2.0, you should implement the ICodeGenerator members in the CodeDomProvider class and throw a NotSupportedException when this method is called.

Applies to

CreateGenerator(TextWriter)

Source:
CodeDomProvider.cs
Source:
CodeDomProvider.cs
Source:
CodeDomProvider.cs
Source:
CodeDomProvider.cs

When overridden in a derived class, creates a new code generator using the specified TextWriter for output.

public:
 virtual System::CodeDom::Compiler::ICodeGenerator ^ CreateGenerator(System::IO::TextWriter ^ output);
public virtual System.CodeDom.Compiler.ICodeGenerator CreateGenerator (System.IO.TextWriter output);
abstract member CreateGenerator : System.IO.TextWriter -> System.CodeDom.Compiler.ICodeGenerator
override this.CreateGenerator : System.IO.TextWriter -> System.CodeDom.Compiler.ICodeGenerator
Public Overridable Function CreateGenerator (output As TextWriter) As ICodeGenerator

Parameters

output
TextWriter

A TextWriter to use to output.

Returns

An ICodeGenerator that can be used to generate System.CodeDom based source code representations.

Remarks

This method uses the specified TextWriter for output. This method supports more optimized code generation that incrementally updates the source code.

Note

The base class implementation calls the CreateGenerator method, which is obsolete in the .NET Framework 2.0 and results in a NotSupportedException if an ICodeGenerator object is not returned.

See also

Applies to

CreateGenerator(String)

Source:
CodeDomProvider.cs
Source:
CodeDomProvider.cs
Source:
CodeDomProvider.cs
Source:
CodeDomProvider.cs

When overridden in a derived class, creates a new code generator using the specified file name for output.

public:
 virtual System::CodeDom::Compiler::ICodeGenerator ^ CreateGenerator(System::String ^ fileName);
public virtual System.CodeDom.Compiler.ICodeGenerator CreateGenerator (string fileName);
abstract member CreateGenerator : string -> System.CodeDom.Compiler.ICodeGenerator
override this.CreateGenerator : string -> System.CodeDom.Compiler.ICodeGenerator
Public Overridable Function CreateGenerator (fileName As String) As ICodeGenerator

Parameters

fileName
String

The file name to output to.

Returns

An ICodeGenerator that can be used to generate System.CodeDom based source code representations.

Remarks

This method uses the specified file name for output.

Note

The base class implementation calls the CreateGenerator method, which is obsolete in the .NET Framework 2.0 and results in a NotSupportedException if an ICodeGenerator object is not returned.

Applies to