CodeDomProvider クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
CodeDomProvider実装の基本クラスを提供します。 このクラスは抽象クラスです。
public ref class CodeDomProvider abstract : System::ComponentModel::Component
public abstract class CodeDomProvider : System.ComponentModel.Component
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class CodeDomProvider : System.ComponentModel.Component
type CodeDomProvider = class
inherit Component
[<System.Runtime.InteropServices.ComVisible(true)>]
type CodeDomProvider = class
inherit Component
Public MustInherit Class CodeDomProvider
Inherits Component
- 継承
- 派生
- 属性
例
次のプログラム例では、Console クラスを使用して "Hello World" を出力するプログラムの CodeDOM モデルに基づいてソース コードを生成およびコンパイルできます。 Windows フォームユーザー インターフェイスが提供されます。 ユーザーは、C#、Visual Basic、JScript など、複数の選択からターゲット プログラミング言語を選択できます。
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Microsoft.CSharp;
using Microsoft.VisualBasic;
using Microsoft.JScript;
// This example demonstrates building a Hello World program graph
// using System.CodeDom elements. It calls code generator and
// code compiler methods to build the program using CSharp, VB, or
// JScript. A Windows Forms interface is included. Note: Code
// must be compiled and linked with the Microsoft.JScript assembly.
namespace CodeDOMExample
{
class CodeDomExample
{
// Build a Hello World program graph using
// System.CodeDom types.
public static CodeCompileUnit BuildHelloWorldGraph()
{
// Create a new CodeCompileUnit to contain
// the program graph.
CodeCompileUnit compileUnit = new CodeCompileUnit();
// Declare a new namespace called Samples.
CodeNamespace samples = new CodeNamespace("Samples");
// Add the new namespace to the compile unit.
compileUnit.Namespaces.Add(samples);
// Add the new namespace import for the System namespace.
samples.Imports.Add(new CodeNamespaceImport("System"));
// Declare a new type called Class1.
CodeTypeDeclaration class1 = new CodeTypeDeclaration("Class1");
// Add the new type to the namespace type collection.
samples.Types.Add(class1);
// Declare a new code entry point method.
CodeEntryPointMethod start = new CodeEntryPointMethod();
// Create a type reference for the System.Console class.
CodeTypeReferenceExpression csSystemConsoleType = new CodeTypeReferenceExpression("System.Console");
// Build a Console.WriteLine statement.
CodeMethodInvokeExpression cs1 = new CodeMethodInvokeExpression(
csSystemConsoleType, "WriteLine",
new CodePrimitiveExpression("Hello World!"));
// Add the WriteLine call to the statement collection.
start.Statements.Add(cs1);
// Build another Console.WriteLine statement.
CodeMethodInvokeExpression cs2 = new CodeMethodInvokeExpression(
csSystemConsoleType, "WriteLine",
new CodePrimitiveExpression("Press the Enter key to continue."));
// Add the WriteLine call to the statement collection.
start.Statements.Add(cs2);
// Build a call to System.Console.ReadLine.
CodeMethodInvokeExpression csReadLine = new CodeMethodInvokeExpression(
csSystemConsoleType, "ReadLine");
// Add the ReadLine statement.
start.Statements.Add(csReadLine);
// Add the code entry point method to
// the Members collection of the type.
class1.Members.Add(start);
return compileUnit;
}
public static void GenerateCode(CodeDomProvider provider,
CodeCompileUnit compileunit)
{
// Build the source file name with the appropriate
// language extension.
String sourceFile;
if (provider.FileExtension[0] == '.')
{
sourceFile = "TestGraph" + provider.FileExtension;
}
else
{
sourceFile = "TestGraph." + provider.FileExtension;
}
// Create an IndentedTextWriter, constructed with
// a StreamWriter to the source file.
IndentedTextWriter tw = new IndentedTextWriter(new StreamWriter(sourceFile, false), " ");
// Generate source code using the code generator.
provider.GenerateCodeFromCompileUnit(compileunit, tw, new CodeGeneratorOptions());
// Close the output file.
tw.Close();
}
public static CompilerResults CompileCode(CodeDomProvider provider,
String sourceFile,
String exeFile)
{
// Configure a CompilerParameters that links System.dll
// and produces the specified executable file.
String[] referenceAssemblies = { "System.dll" };
CompilerParameters cp = new CompilerParameters(referenceAssemblies,
exeFile, false);
// Generate an executable rather than a DLL file.
cp.GenerateExecutable = true;
// Invoke compilation.
CompilerResults cr = provider.CompileAssemblyFromFile(cp, sourceFile);
// Return the results of compilation.
return cr;
}
}
public class CodeDomExampleForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Button run_button = new System.Windows.Forms.Button();
private System.Windows.Forms.Button compile_button = new System.Windows.Forms.Button();
private System.Windows.Forms.Button generate_button = new System.Windows.Forms.Button();
private System.Windows.Forms.TextBox textBox1 = new System.Windows.Forms.TextBox();
private System.Windows.Forms.ComboBox comboBox1 = new System.Windows.Forms.ComboBox();
private System.Windows.Forms.Label label1 = new System.Windows.Forms.Label();
private void generate_button_Click(object sender, System.EventArgs e)
{
CodeDomProvider provider = GetCurrentProvider();
CodeDomExample.GenerateCode(provider, CodeDomExample.BuildHelloWorldGraph());
// Build the source file name with the appropriate
// language extension.
String sourceFile;
if (provider.FileExtension[0] == '.')
{
sourceFile = "TestGraph" + provider.FileExtension;
}
else
{
sourceFile = "TestGraph." + provider.FileExtension;
}
// Read in the generated source file and
// display the source text.
StreamReader sr = new StreamReader(sourceFile);
textBox1.Text = sr.ReadToEnd();
sr.Close();
}
private void compile_button_Click(object sender, System.EventArgs e)
{
CodeDomProvider provider = GetCurrentProvider();
// Build the source file name with the appropriate
// language extension.
String sourceFile;
if (provider.FileExtension[0] == '.')
{
sourceFile = "TestGraph" + provider.FileExtension;
}
else
{
sourceFile = "TestGraph." + provider.FileExtension;
}
// Compile the source file into an executable output file.
CompilerResults cr = CodeDomExample.CompileCode(provider,
sourceFile,
"TestGraph.exe");
if (cr.Errors.Count > 0)
{
// Display compilation errors.
textBox1.Text = "Errors encountered while building " +
sourceFile + " into " + cr.PathToAssembly + ": \r\n\n";
foreach (CompilerError ce in cr.Errors)
textBox1.AppendText(ce.ToString() + "\r\n");
run_button.Enabled = false;
}
else
{
textBox1.Text = "Source " + sourceFile + " built into " +
cr.PathToAssembly + " with no errors.";
run_button.Enabled = true;
}
}
private void run_button_Click(object sender,
System.EventArgs e)
{
Process.Start("TestGraph.exe");
}
private CodeDomProvider GetCurrentProvider()
{
CodeDomProvider provider;
switch ((string)this.comboBox1.SelectedItem)
{
case "CSharp":
provider = CodeDomProvider.CreateProvider("CSharp");
break;
case "Visual Basic":
provider = CodeDomProvider.CreateProvider("VisualBasic");
break;
case "JScript":
provider = CodeDomProvider.CreateProvider("JScript");
break;
default:
provider = CodeDomProvider.CreateProvider("CSharp");
break;
}
return provider;
}
public CodeDomExampleForm()
{
this.SuspendLayout();
// Set properties for label1
this.label1.Location = new System.Drawing.Point(395, 20);
this.label1.Size = new Size(180, 22);
this.label1.Text = "Select a programming language:";
// Set properties for comboBox1
this.comboBox1.Location = new System.Drawing.Point(560, 16);
this.comboBox1.Size = new Size(190, 23);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Items.AddRange(new string[] { "CSharp", "Visual Basic", "JScript" });
this.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left
| System.Windows.Forms.AnchorStyles.Right
| System.Windows.Forms.AnchorStyles.Top;
this.comboBox1.SelectedIndex = 0;
// Set properties for generate_button.
this.generate_button.Location = new System.Drawing.Point(8, 16);
this.generate_button.Name = "generate_button";
this.generate_button.Size = new System.Drawing.Size(120, 23);
this.generate_button.Text = "Generate Code";
this.generate_button.Click += new System.EventHandler(this.generate_button_Click);
// Set properties for compile_button.
this.compile_button.Location = new System.Drawing.Point(136, 16);
this.compile_button.Name = "compile_button";
this.compile_button.Size = new System.Drawing.Size(120, 23);
this.compile_button.Text = "Compile";
this.compile_button.Click += new System.EventHandler(this.compile_button_Click);
// Set properties for run_button.
this.run_button.Enabled = false;
this.run_button.Location = new System.Drawing.Point(264, 16);
this.run_button.Name = "run_button";
this.run_button.Size = new System.Drawing.Size(120, 23);
this.run_button.Text = "Run";
this.run_button.Click += new System.EventHandler(this.run_button_Click);
// Set properties for textBox1.
this.textBox1.Anchor = (System.Windows.Forms.AnchorStyles.Top
| System.Windows.Forms.AnchorStyles.Bottom
| System.Windows.Forms.AnchorStyles.Left
| System.Windows.Forms.AnchorStyles.Right);
this.textBox1.Location = new System.Drawing.Point(8, 48);
this.textBox1.Multiline = true;
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(744, 280);
this.textBox1.Text = "";
// Set properties for the CodeDomExampleForm.
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(768, 340);
this.MinimumSize = new System.Drawing.Size(750, 340);
this.Controls.AddRange(new System.Windows.Forms.Control[] {this.textBox1,
this.run_button, this.compile_button, this.generate_button,
this.comboBox1, this.label1 });
this.Name = "CodeDomExampleForm";
this.Text = "CodeDom Hello World Example";
this.ResumeLayout(false);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
[STAThread]
static void Main()
{
Application.Run(new CodeDomExampleForm());
}
}
}
Imports System.CodeDom
Imports System.CodeDom.Compiler
Imports System.Collections
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Drawing
Imports System.IO
Imports System.Windows.Forms
Imports Microsoft.CSharp
Imports Microsoft.JScript
' This example demonstrates building a Hello World program graph
' using System.CodeDom elements. It calls code generator and
' code compiler methods to build the program using CSharp, VB, or
' JScript. A Windows Forms interface is included. Note: Code
' must be compiled and linked with the Microsoft.JScript assembly.
Namespace CodeDOMExample
Class CodeDomExample
' Build a Hello World program graph using
' System.CodeDom types.
Public Shared Function BuildHelloWorldGraph() As CodeCompileUnit
' Create a new CodeCompileUnit to contain
' the program graph.
Dim compileUnit As New CodeCompileUnit()
' Declare a new namespace called Samples.
Dim samples As New CodeNamespace("Samples")
' Add the new namespace to the compile unit.
compileUnit.Namespaces.Add(samples)
' Add the new namespace import for the System namespace.
samples.Imports.Add(New CodeNamespaceImport("System"))
' Declare a new type called Class1.
Dim class1 As New CodeTypeDeclaration("Class1")
' Add the new type to the namespace type collection.
samples.Types.Add(class1)
' Declare a new code entry point method.
Dim start As New CodeEntryPointMethod()
' Create a type reference for the System.Console class.
Dim csSystemConsoleType As New CodeTypeReferenceExpression( _
"System.Console")
' Build a Console.WriteLine statement.
Dim cs1 As New CodeMethodInvokeExpression( _
csSystemConsoleType, "WriteLine", _
New CodePrimitiveExpression("Hello World!"))
' Add the WriteLine call to the statement collection.
start.Statements.Add(cs1)
' Build another Console.WriteLine statement.
Dim cs2 As New CodeMethodInvokeExpression( _
csSystemConsoleType, "WriteLine", _
New CodePrimitiveExpression("Press the Enter key to continue."))
' Add the WriteLine call to the statement collection.
start.Statements.Add(cs2)
' Build a call to System.Console.ReadLine.
Dim csReadLine As New CodeMethodInvokeExpression( _
csSystemConsoleType, "ReadLine")
' Add the ReadLine statement.
start.Statements.Add(csReadLine)
' Add the code entry point method to
' the Members collection of the type.
class1.Members.Add(start)
Return compileUnit
End Function
Public Shared Sub GenerateCode(ByVal provider As CodeDomProvider, ByVal compileunit As CodeCompileUnit)
' Build the source file name with the appropriate
' language extension.
Dim sourceFile As String
If provider.FileExtension.StartsWith(".") Then
sourceFile = "TestGraph" + provider.FileExtension
Else
sourceFile = "TestGraph." + provider.FileExtension
End If
' Create an IndentedTextWriter, constructed with
' a StreamWriter to the source file.
Dim tw As New IndentedTextWriter(New StreamWriter(sourceFile, False), " ")
' Generate source code using the code generator.
provider.GenerateCodeFromCompileUnit(compileunit, tw, New CodeGeneratorOptions())
' Close the output file.
tw.Close()
End Sub
Public Shared Function CompileCode(ByVal provider As CodeDomProvider, _
ByVal sourceFile As String, _
ByVal exeFile As String) As CompilerResults
' Configure a CompilerParameters that links System.dll
' and produces the specified executable file.
Dim referenceAssemblies As String() = {"System.dll"}
Dim cp As New CompilerParameters(referenceAssemblies, exeFile, False)
' Generate an executable rather than a DLL file.
cp.GenerateExecutable = True
' Invoke compilation.
Dim cr As CompilerResults = provider.CompileAssemblyFromFile(cp, _
sourceFile)
' Return the results of compilation.
Return cr
End Function
End Class
Public Class CodeDomExampleForm
Inherits System.Windows.Forms.Form
Private run_button As New System.Windows.Forms.Button()
Private compile_button As New System.Windows.Forms.Button()
Private generate_button As New System.Windows.Forms.Button()
Private textBox1 As New System.Windows.Forms.TextBox()
Private comboBox1 As New System.Windows.Forms.ComboBox()
Private label1 As New System.Windows.Forms.Label()
Private Sub generate_button_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim provider As CodeDomProvider = GetCurrentProvider()
CodeDomExample.GenerateCode(provider, CodeDomExample.BuildHelloWorldGraph())
' Build the source file name with the appropriate
' language extension.
Dim sourceFile As String
If provider.FileExtension.StartsWith(".") Then
sourceFile = "TestGraph" + provider.FileExtension
Else
sourceFile = "TestGraph." + provider.FileExtension
End If
' Read in the generated source file and
' display the source text.
Dim sr As New StreamReader(sourceFile)
textBox1.Text = sr.ReadToEnd()
sr.Close()
End Sub
Private Sub compile_button_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim provider As CodeDomProvider = GetCurrentProvider()
' Build the source file name with the appropriate
' language extension.
Dim sourceFile As String
If provider.FileExtension.StartsWith(".") Then
sourceFile = "TestGraph" + provider.FileExtension
Else
sourceFile = "TestGraph." + provider.FileExtension
End If
Dim cr As CompilerResults = CodeDomExample.CompileCode(provider, _
sourceFile, _
"TestGraph.EXE")
If cr.Errors.Count > 0 Then
' Display compilation errors.
textBox1.Text = "Errors encountered while building " + _
sourceFile + " into " + _
cr.PathToAssembly + ": " + ControlChars.CrLf
Dim ce As System.CodeDom.Compiler.CompilerError
For Each ce In cr.Errors
textBox1.AppendText(ce.ToString() + ControlChars.CrLf)
Next ce
run_button.Enabled = False
Else
textBox1.Text = "Source " + sourceFile + " built into " + _
cr.PathToAssembly + " with no errors."
run_button.Enabled = True
End If
End Sub
Private Sub run_button_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
Process.Start("TestGraph.EXE")
End Sub
Private Function GetCurrentProvider() As CodeDomProvider
Dim provider As CodeDomProvider
Select Case CStr(Me.comboBox1.SelectedItem)
Case "CSharp"
provider = CodeDomProvider.CreateProvider("CSharp")
Case "Visual Basic"
provider = CodeDomProvider.CreateProvider("VisualBasic")
Case "JScript"
provider = CodeDomProvider.CreateProvider("JScript")
Case Else
provider = CodeDomProvider.CreateProvider("CSharp")
End Select
Return provider
End Function
Public Sub New()
Me.SuspendLayout()
' Set properties for label1.
Me.label1.Location = New System.Drawing.Point(395, 20)
Me.label1.Size = New Size(180, 22)
Me.label1.Text = "Select a programming language:"
' Set properties for comboBox1.
Me.comboBox1.Location = New System.Drawing.Point(560, 16)
Me.comboBox1.Size = New Size(190, 23)
Me.comboBox1.Name = "comboBox1"
Me.comboBox1.Items.AddRange(New String() {"CSharp", "Visual Basic", "JScript"})
Me.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right Or System.Windows.Forms.AnchorStyles.Top
Me.comboBox1.SelectedIndex = 0
' Set properties for generate_button.
Me.generate_button.Location = New System.Drawing.Point(8, 16)
Me.generate_button.Name = "generate_button"
Me.generate_button.Size = New System.Drawing.Size(120, 23)
Me.generate_button.Text = "Generate Code"
AddHandler generate_button.Click, AddressOf Me.generate_button_Click
' Set properties for compile_button.
Me.compile_button.Location = New System.Drawing.Point(136, 16)
Me.compile_button.Name = "compile_button"
Me.compile_button.Size = New System.Drawing.Size(120, 23)
Me.compile_button.Text = "Compile"
AddHandler compile_button.Click, AddressOf Me.compile_button_Click
' Set properties for run_button.
Me.run_button.Enabled = False
Me.run_button.Location = New System.Drawing.Point(264, 16)
Me.run_button.Name = "run_button"
Me.run_button.Size = New System.Drawing.Size(120, 23)
Me.run_button.Text = "Run"
AddHandler run_button.Click, AddressOf Me.run_button_Click
' Set properties for textBox1.
Me.textBox1.Anchor = System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right
Me.textBox1.Location = New System.Drawing.Point(8, 48)
Me.textBox1.Multiline = True
Me.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.textBox1.Name = "textBox1"
Me.textBox1.Size = New System.Drawing.Size(744, 280)
Me.textBox1.Text = ""
' Set properties for the CodeDomExampleForm.
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(768, 340)
Me.MinimumSize = New System.Drawing.Size(750, 340)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.textBox1, _
Me.run_button, Me.compile_button, Me.generate_button, _
Me.comboBox1, Me.label1})
Me.Name = "CodeDomExampleForm"
Me.Text = "CodeDom Hello World Example"
Me.ResumeLayout(False)
End Sub
Protected Overloads Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
<STAThread()> _
Shared Sub Main()
Application.Run(New CodeDomExampleForm())
End Sub
End Class
End Namespace
注釈
CodeDomProviderを使用して、コード ジェネレーターとコード コンパイラのインスタンスを作成および取得できます。 コード ジェネレーターを使用して特定の言語でコードを生成し、コード コンパイラを使用してコードをアセンブリにコンパイルできます。
CodeDomProvider実装では、通常、コードを生成し、1 つのプログラミング言語のコンパイルを管理するためのコード生成インターフェイスやコード コンパイル インターフェイスが提供されます。 Windows SDK に付属する CodeDomProvider 実装では、いくつかの言語がサポートされています。 これらの言語には、C#、Visual Basic、C++、JScript が含まれます。 開発者またはコンパイラ ベンダーは、 ICodeGenerator インターフェイスと ICodeCompiler インターフェイスを実装し、CodeDOM のサポートを他のプログラミング言語に拡張する CodeDomProvider を提供できます。
コンピューター構成ファイル (Machine.config) の <system.codedom> 要素 は、開発者とコンパイラ ベンダーが追加の CodeDomProvider 実装の構成設定を追加するためのメカニズムを提供します。
CodeDomProvider クラスは、コンピューター上のCodeDomProvider実装を検出して列挙するための静的メソッドを提供します。 GetAllCompilerInfo メソッドは、コンピューター上のすべてのCodeDomProvider実装の設定を返します。 GetCompilerInfo メソッドは、プログラミング言語名に基づいて、特定のCodeDomProvider実装の設定を返します。 CreateProvider メソッドは、特定の言語のCodeDomProvider実装のインスタンスを返します。
構成ファイルの言語プロバイダー設定の詳細については、「 コンパイラと言語プロバイダーの設定スキーマ」を参照してください。
注
このクラスは、クラス レベルでリンク要求と継承要求を行います。 直接呼び出し元または派生クラスに完全信頼アクセス許可がない場合、 SecurityException がスローされます。 セキュリティ要求の詳細については、「 リンク要求」を参照してください。
注意 (実装者)
.NET Framework 1.0 および 1.1 では、コード プロバイダーは、CodeDomProvider、ICodeGenerator、ICodeParser、および ICodeCompiler の実装で構成されます。 .NET Framework 2.0 以降では、CreateGenerator()、CreateParser()、および CreateCompiler() メソッドは廃止され、ICodeGenerator および ICodeCompiler のメソッドは、CodeDomProvider クラスで直接使用できます。 基本メソッドを呼び出すのではなく、コード プロバイダーの実装でこれらのメソッドをオーバーライドする必要があります。
コンストラクター
| 名前 | 説明 |
|---|---|
| CodeDomProvider() |
CodeDomProvider クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| CanRaiseEvents |
コンポーネントがイベントを発生できるかどうかを示す値を取得します。 (継承元 Component) |
| Container |
IContainerを含むComponentを取得します。 (継承元 Component) |
| DesignMode |
Componentが現在デザイン モードであるかどうかを示す値を取得します。 (継承元 Component) |
| Events |
この Componentにアタッチされているイベント ハンドラーの一覧を取得します。 (継承元 Component) |
| FileExtension |
現在の言語のソース コード ファイルに使用する既定のファイル名拡張子を取得します。 |
| LanguageOptions |
言語機能識別子を取得します。 |
| Site | (継承元 Component) |
メソッド
| 名前 | 説明 |
|---|---|
| CompileAssemblyFromDom(CompilerParameters, CodeCompileUnit[]) |
指定したコンパイラ設定を使用して、CodeCompileUnit オブジェクトの指定した配列に含まれるSystem.CodeDom ツリーに基づいてアセンブリをコンパイルします。 |
| CompileAssemblyFromFile(CompilerParameters, String[]) |
指定したコンパイラ設定を使用して、指定したファイルに含まれるソース コードからアセンブリをコンパイルします。 |
| CompileAssemblyFromSource(CompilerParameters, String[]) |
指定したコンパイラ設定を使用して、ソース コードを含む文字列の指定した配列からアセンブリをコンパイルします。 |
| CreateCompiler() |
古い.
古い.
派生クラスでオーバーライドされた場合は、新しいコード コンパイラを作成します。 |
| CreateEscapedIdentifier(String) |
指定した値のエスケープされた識別子を作成します。 |
| CreateGenerator() |
古い.
古い.
派生クラスでオーバーライドされた場合は、新しいコード ジェネレーターを作成します。 |
| CreateGenerator(String) |
派生クラスでオーバーライドされた場合は、指定したファイル名を使用して出力用に新しいコード ジェネレーターを作成します。 |
| CreateGenerator(TextWriter) |
派生クラスでオーバーライドされた場合は、出力に指定した TextWriter を使用して新しいコード ジェネレーターを作成します。 |
| CreateObjRef(Type) |
リモート オブジェクトとの通信に使用されるプロキシの生成に必要なすべての関連情報を含むオブジェクトを作成します。 (継承元 MarshalByRefObject) |
| CreateParser() |
古い.
古い.
派生クラスでオーバーライドされた場合は、新しいコード パーサーを作成します。 |
| CreateProvider(String, IDictionary<String,String>) |
指定した言語およびプロバイダー オプションの CodeDomProvider インスタンスを取得します。 |
| CreateProvider(String) |
指定した言語の CodeDomProvider インスタンスを取得します。 |
| CreateValidIdentifier(String) |
指定した値の有効な識別子を作成します。 |
| Dispose() |
Componentによって使用されるすべてのリソースを解放します。 (継承元 Component) |
| Dispose(Boolean) |
Componentによって使用されるアンマネージ リソースを解放し、必要に応じてマネージド リソースを解放します。 (継承元 Component) |
| Equals(Object) |
指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| GenerateCodeFromCompileUnit(CodeCompileUnit, TextWriter, CodeGeneratorOptions) |
指定したコード ドキュメント オブジェクト モデル (CodeDOM) コンパイル ユニットのコードを生成し、指定したオプションを使用して、指定したテキスト ライターに送信します。 |
| GenerateCodeFromExpression(CodeExpression, TextWriter, CodeGeneratorOptions) |
指定したコード ドキュメント オブジェクト モデル (CodeDOM) 式のコードを生成し、指定したオプションを使用して、指定したテキスト ライターに送信します。 |
| GenerateCodeFromMember(CodeTypeMember, TextWriter, CodeGeneratorOptions) |
指定したコード ドキュメント オブジェクト モデル (CodeDOM) メンバー宣言のコードを生成し、指定したオプションを使用して、指定したテキスト ライターに送信します。 |
| GenerateCodeFromNamespace(CodeNamespace, TextWriter, CodeGeneratorOptions) |
指定したコード ドキュメント オブジェクト モデル (CodeDOM) 名前空間のコードを生成し、指定したオプションを使用して、指定したテキスト ライターに送信します。 |
| GenerateCodeFromStatement(CodeStatement, TextWriter, CodeGeneratorOptions) |
指定したコード ドキュメント オブジェクト モデル (CodeDOM) ステートメントのコードを生成し、指定したオプションを使用して、指定したテキスト ライターに送信します。 |
| GenerateCodeFromType(CodeTypeDeclaration, TextWriter, CodeGeneratorOptions) |
指定したコード ドキュメント オブジェクト モデル (CodeDOM) 型宣言のコードを生成し、指定したオプションを使用して、指定したテキスト ライターに送信します。 |
| GetAllCompilerInfo() |
このコンピューターの言語プロバイダーとコンパイラの構成設定を返します。 |
| GetCompilerInfo(String) |
指定した言語の言語プロバイダーとコンパイラ構成設定を返します。 |
| GetConverter(Type) |
指定したデータ型の TypeConverter を取得します。 |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetLanguageFromExtension(String) |
CodeDomProvider コンパイラ構成セクションで構成されている、指定したファイル名拡張子に関連付けられている言語名を返します。 |
| GetLifetimeService() |
古い.
このインスタンスの有効期間ポリシーを制御する現在の有効期間サービス オブジェクトを取得します。 (継承元 MarshalByRefObject) |
| GetService(Type) |
ComponentまたはそのContainerによって提供されるサービスを表すオブジェクトを返します。 (継承元 Component) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| GetTypeOutput(CodeTypeReference) |
指定した CodeTypeReferenceによって示される型を取得します。 |
| InitializeLifetimeService() |
古い.
このインスタンスの有効期間ポリシーを制御する有効期間サービス オブジェクトを取得します。 (継承元 MarshalByRefObject) |
| IsDefinedExtension(String) |
ファイル名拡張子に、コンピューターで構成された CodeDomProvider の実装が関連付けられているかどうかをテストします。 |
| IsDefinedLanguage(String) |
コンピューターで言語に CodeDomProvider 実装が構成されているかどうかをテストします。 |
| IsValidIdentifier(String) |
指定した値が現在の言語の有効な識別子であるかどうかを示す値を返します。 |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| MemberwiseClone(Boolean) |
現在の MarshalByRefObject オブジェクトの簡易コピーを作成します。 (継承元 MarshalByRefObject) |
| Parse(TextReader) |
指定したテキスト ストリームから読み取ったコードを CodeCompileUnitにコンパイルします。 |
| Supports(GeneratorSupport) |
指定したコード生成のサポートが提供されているかどうかを示す値を返します。 |
| ToString() |
Stringの名前 (存在する場合) を含むComponentを返します。 このメソッドはオーバーライドしないでください。 (継承元 Component) |
イベント
| 名前 | 説明 |
|---|---|
| Disposed |
コンポーネントが Dispose() メソッドの呼び出しによって破棄されるときに発生します。 (継承元 Component) |