CodeDomProvider 클래스

정의

CodeDomProvider 구현을 위한 기본 클래스를 제공합니다.Provides a base class for CodeDomProvider implementations. 이 클래스는 추상 클래스입니다.This class is abstract.

public ref class CodeDomProvider abstract : System::ComponentModel::Component
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class CodeDomProvider : System.ComponentModel.Component
type CodeDomProvider = class
    inherit Component
Public MustInherit Class CodeDomProvider
Inherits Component
상속
파생
특성

예제

다음 예제 프로그램에서 생성 하 고 "Hello World"를 사용 하 여 출력 하는 프로그램의 CodeDOM 모델을 기반으로 하는 소스 코드를 컴파일할 수는 Console 클래스입니다.The following example program can generate and compile source code based on a CodeDOM model of a program that prints "Hello World" using the Console class. Windows Forms 사용자 인터페이스를 제공 됩니다.A Windows Forms user interface is provided. 사용자는 여러 선택 항목에서 대상 프로그래밍 언어를 선택할 수 있습니다. C#, Visual Basic 및 JScriptThe user can select the target programming language from several selections: C#, Visual Basic, and JScript.

#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
#using <System.dll>
#using <Microsoft.JScript.dll>

using namespace System;
using namespace System::CodeDom;
using namespace System::CodeDom::Compiler;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::Diagnostics;
using namespace System::Drawing;
using namespace System::IO;
using namespace System::Windows::Forms;
using namespace Microsoft::CSharp;
using namespace Microsoft::VisualBasic;
using namespace Microsoft::JScript;
using namespace System::Security::Permissions;

// 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
{
    [PermissionSet(SecurityAction::Demand, Name="FullTrust")]
    public ref class CodeDomExample
    {
    public:
        // Build a Hello World program graph using 
        // System::CodeDom types.
        static CodeCompileUnit^ BuildHelloWorldGraph()
        {
            // Create a new CodeCompileUnit to contain 
            // the program graph.
            CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit;

            // Declare a new namespace called Samples.
            CodeNamespace^ samples = gcnew 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( gcnew CodeNamespaceImport( "System" ) );

            // Declare a new type called Class1.
            CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration( "Class1" );

            // Add the new type to the namespace's type collection.
            samples->Types->Add( class1 );

            // Declare a new code entry point method.
            CodeEntryPointMethod^ start = gcnew CodeEntryPointMethod;

            // Create a type reference for the System::Console class.
            CodeTypeReferenceExpression^ csSystemConsoleType = gcnew CodeTypeReferenceExpression( "System.Console" );

            // Build a Console::WriteLine statement.
            CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine", gcnew CodePrimitiveExpression("Hello World!") );

            // Add the WriteLine call to the statement collection.
            start->Statements->Add( cs1 );

            // Build another Console::WriteLine statement.
            CodeMethodInvokeExpression^ cs2 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine", gcnew 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.
            CodeMethodReferenceExpression^ csReadLine = gcnew CodeMethodReferenceExpression( csSystemConsoleType, "ReadLine" );
            CodeMethodInvokeExpression^ cs3 = gcnew CodeMethodInvokeExpression( csReadLine, gcnew array<CodeExpression^>(0) );

            // Add the ReadLine statement.
            start->Statements->Add( cs3 );

            // Add the code entry point method to
            // the Members collection of the type.
            class1->Members->Add( start );
            return compileUnit;
        }

        static void GenerateCode( CodeDomProvider^ provider, CodeCompileUnit^ compileunit )
        {
            // Build the source file name with the appropriate
            // language extension.
            String^ sourceFile;
            if ( provider->FileExtension->StartsWith( "." ) )
            {
                sourceFile = String::Concat( "TestGraph", provider->FileExtension );
            }
            else
            {
                sourceFile = String::Concat( "TestGraph.", provider->FileExtension );
            }

            // Create an IndentedTextWriter, constructed with
            // a StreamWriter to the source file.
            IndentedTextWriter^ tw = gcnew IndentedTextWriter( gcnew StreamWriter( sourceFile,false ),"    " );

            // Generate source code using the code generator.
            provider->GenerateCodeFromCompileUnit( compileunit, tw, gcnew CodeGeneratorOptions );

            // Close the output file.
            tw->Close();
        }

        static CompilerResults^ CompileCode( CodeDomProvider^ provider, String^ sourceFile, String^ exeFile )
        {
            // Configure a CompilerParameters that links System.dll
            // and produces the specified executable file.
            array<String^>^referenceAssemblies = {"System.dll"};
            CompilerParameters^ cp = gcnew 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 ref class CodeDomExampleForm: public System::Windows::Forms::Form
    {
    private:
        static System::Windows::Forms::Button^ run_button = gcnew System::Windows::Forms::Button;
        static System::Windows::Forms::Button^ compile_button = gcnew System::Windows::Forms::Button;
        static System::Windows::Forms::Button^ generate_button = gcnew System::Windows::Forms::Button;
        static System::Windows::Forms::TextBox^ textBox1 = gcnew System::Windows::Forms::TextBox;
        static System::Windows::Forms::ComboBox^ comboBox1 = gcnew System::Windows::Forms::ComboBox;
        static System::Windows::Forms::Label^ label1 = gcnew System::Windows::Forms::Label;
        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->StartsWith( "." ) )
            {
                sourceFile = String::Concat( "TestGraph", provider->FileExtension );
            }
            else
            {
                sourceFile = String::Concat( "TestGraph.", provider->FileExtension );
            }


            // Read in the generated source file and
            // display the source text.
            StreamReader^ sr = gcnew StreamReader( sourceFile );
            textBox1->Text = sr->ReadToEnd();
            sr->Close();
        }

        CodeDomProvider^ GetCurrentProvider()
        {
            CodeDomProvider^ provider;
            if ( String::Compare( dynamic_cast<String^>(this->comboBox1->SelectedItem), "CSharp" ) == 0 )
                provider = CodeDomProvider::CreateProvider("CSharp");
            else
                if ( String::Compare( dynamic_cast<String^>(this->comboBox1->SelectedItem), "Visual Basic" ) == 0 )
                    provider = CodeDomProvider::CreateProvider("VisualBasic");
                else
                    if ( String::Compare( dynamic_cast<String^>(this->comboBox1->SelectedItem), "JScript" ) == 0 )
                        provider = CodeDomProvider::CreateProvider("JScript");
                    else
                        provider = CodeDomProvider::CreateProvider("CSharp");

            return provider;
        }

        void compile_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
        {
            CodeDomProvider^ provider = GetCurrentProvider();

            // Build the source file name with the appropriate
            // language extension.
            String^ sourceFile = String::Concat( "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 = String::Concat( "Errors encountered while building ", sourceFile, " into ", cr->PathToAssembly, ": \r\n\n" );
                System::CodeDom::Compiler::CompilerError^ ce;
                for ( int i = 0; i < cr->Errors->Count; i++ )
                {
                    ce = cr->Errors[i];
                    textBox1->AppendText( String::Concat( ce->ToString(), "\r\n" ) );

                }
                run_button->Enabled = false;
            }
            else
            {
                textBox1->Text = String::Concat( "Source ", sourceFile, " built into ", cr->PathToAssembly, " with no errors." );
                run_button->Enabled = true;
            }
        }

        void run_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
        {
            Process::Start( "TestGraph.exe" );
        }

    public:
        CodeDomExampleForm()
        {
            this->SuspendLayout();

            // Set properties for label1.
            this->label1->Location = System::Drawing::Point( 395, 20 );
            this->label1->Size = System::Drawing::Size( 180, 22 );
            this->label1->Text = "Select a programming language:";

            // Set properties for comboBox1.
            this->comboBox1->Location = System::Drawing::Point( 560, 16 );
            this->comboBox1->Size = System::Drawing::Size( 190, 23 );
            this->comboBox1->Name = "comboBox1";
            array<String^>^temp1 = {"CSharp","Visual Basic","JScript"};
            this->comboBox1->Items->AddRange( temp1 );
            this->comboBox1->Anchor = (System::Windows::Forms::AnchorStyles)(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 = System::Drawing::Point( 8, 16 );
            this->generate_button->Name = "generate_button";
            this->generate_button->Size = System::Drawing::Size( 120, 23 );
            this->generate_button->Text = "Generate Code";
            this->generate_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::generate_button_Click );

            // Set properties for compile_button.
            this->compile_button->Location = System::Drawing::Point( 136, 16 );
            this->compile_button->Name = "compile_button";
            this->compile_button->Size = System::Drawing::Size( 120, 23 );
            this->compile_button->Text = "Compile";
            this->compile_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::compile_button_Click );

            // Set properties for run_button.
            this->run_button->Enabled = false;
            this->run_button->Location = System::Drawing::Point( 264, 16 );
            this->run_button->Name = "run_button";
            this->run_button->Size = System::Drawing::Size( 120, 23 );
            this->run_button->Text = "Run";
            this->run_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::run_button_Click );

            // Set properties for textBox1.
            this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right);
            this->textBox1->Location = System::Drawing::Point( 8, 48 );
            this->textBox1->Multiline = true;
            this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical;
            this->textBox1->Name = "textBox1";
            this->textBox1->Size = System::Drawing::Size( 744, 280 );
            this->textBox1->Text = "";

            // Set properties for the CodeDomExampleForm.
            this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 );
            this->ClientSize = System::Drawing::Size( 768, 340 );
            this->MinimumSize = System::Drawing::Size( 750, 340 );
            array<System::Windows::Forms::Control^>^myControl = {this->textBox1,this->run_button,this->compile_button,this->generate_button,this->comboBox1,this->label1};
            this->Controls->AddRange( myControl );
            this->Name = "CodeDomExampleForm";
            this->Text = "CodeDom Hello World Example";
            this->ResumeLayout( false );
        }

    public:
        ~CodeDomExampleForm()
        {
        }
    };

}

[STAThread]
int main()
{
    Application::Run( gcnew CodeDOMExample::CodeDomExampleForm );
}
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 만들기 및 코드 생성기 및 코드 컴파일러의 인스턴스를 검색에 사용할 수 있습니다.A CodeDomProvider can be used to create and retrieve instances of code generators and code compilers. 코드 생성기를 사용하여 코드를 특정 언어로 생성하고, 코드 컴파일러를 사용하여 코드를 어셈블리로 컴파일할 수 있습니다.Code generators can be used to generate code in a particular language, and code compilers can be used to compile code into assemblies.

참고

.NET Framework 2.0.NET Framework 2.0, 메서드 코드 생성기에서 사용 가능 및 코드 컴파일러 코드 공급자에서 직접 사용할 수 있습니다.In the .NET Framework 2.0.NET Framework 2.0, the methods made available in the code generator and code compiler are available directly from the code provider. 호출할 필요가 없습니다 CreateGenerator 또는 CreateCompiler 액세스 하는 메서드 및 해당 메서드는 되지 않음으로 표시 합니다.You do not need to call CreateGenerator or CreateCompiler to access the methods, and those methods are marked as obsolete. 이 새 코드 공급자 구현을 뿐만 아니라 기존에 적용 됩니다.This applies to preexisting as well as new code provider implementations.

CodeDomProvider 구현은 일반적으로 제공 코드 생성 및/또는 코드 컴파일 인터페이스 코드를 생성 하 고 단일 프로그래밍 언어에 대 한 컴파일 관리에 대 한 합니다.A CodeDomProvider implementation typically provides code generation and/or code compilation interfaces for generating code and managing compilation for a single programming language. Windows SDK와 함께 제공 되 CodeDomProvider 는 구현에서 지원 되는 언어는 여러 가지가 있습니다.Several languages are supported by CodeDomProvider implementations that ship with the Windows SDK. 이러한 언어는 C#, Visual Basic, c + + 및 JScript를 포함 합니다.These languages include C#, Visual Basic, C++, and JScript. 개발자 또는 컴파일러 공급 업체 구현할 수 있습니다는 ICodeGenerator 하 고 ICodeCompiler 인터페이스를 만들고 제공을 CodeDomProvider CodeDOM 지원을 다른 프로그래밍 언어를 확장 하는 합니다.Developers or compiler vendors can implement the ICodeGenerator and ICodeCompiler interfaces and provide a CodeDomProvider that extends CodeDOM support to other programming languages.

합니다 <system.codedom> 요소 파일 (Machine.config) 컴퓨터 구성에서 추가 에대한구성설정을추가하는개발자및컴파일러공급업체에대한메커니즘을제공CodeDomProvider구현입니다.The <system.codedom> Element in the machine configuration file (Machine.config) provides a mechanism for developers and compiler vendors to add configuration settings for additional CodeDomProvider implementations.

합니다 CodeDomProvider 검색 및 열거를 위한 정적 메서드를 제공 하는 클래스는 CodeDomProvider 컴퓨터에서 구현 합니다.The CodeDomProvider class provides static methods to discover and enumerate the CodeDomProvider implementations on a computer. 합니다 GetAllCompilerInfo 메서드 모두에 대 한 설정을 반환 CodeDomProvider 컴퓨터 구현 합니다.The GetAllCompilerInfo method returns the settings for all CodeDomProvider implementations on a computer. 합니다 GetCompilerInfo 메서드는 특정 설정을 반환 CodeDomProvider 프로그래밍 언어 이름을 기반으로 구현 합니다.The GetCompilerInfo method returns the settings for a specific CodeDomProvider implementation, based on the programming language name. 합니다 CreateProvider 의 인스턴스를 반환 하는 메서드를 CodeDomProvider 특정 언어에 대 한 구현 합니다.The CreateProvider method returns an instance of a CodeDomProvider implementation for a specific language.

구성 파일에서 언어 공급자 설정에 대 한 자세한 내용은 참조 하세요. 컴파일러 및 언어 공급자 설정 스키마합니다.For more details on language provider settings in the configuration file, see Compiler and Language Provider Settings Schema.

참고

이 클래스는 클래스 수준에서 상속 요청과 링크 요청을 만듭니다.This class makes a link demand and an inheritance demand at the class level. SecurityException 직접 실행 호출자 또는 파생된 클래스에 완전 신뢰 권한이 없는 경우 throw 됩니다.A SecurityException is thrown if either the immediate caller or the derived class does not have full trust permission. 보안 요청에 대 한 자세한 내용은 참조 하세요 링크 요청 하 고 상속 요청합니다.For details about security demands, see Link Demands and Inheritance Demands.

구현자 참고

.NET Framework 버전 1.0 및 1.1에서는 코드 공급자 구성 구현의 CodeDomProvider, ICodeGenerator, ICodeParser, 및 ICodeCompiler합니다.In the .NET Framework versions 1.0 and 1.1, code providers consist of implementations of CodeDomProvider, ICodeGenerator, ICodeParser, and ICodeCompiler. .NET Framework 2.0.NET Framework 2.0, CreateGenerator(), CreateParser(), 및 CreateCompiler() 메서드는 사용 되지 않는의 메서드와 ICodeGeneratorICodeCompiler 에서 직접 사용할 수는 CodeDomProvider 클래스입니다.In the .NET Framework 2.0.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.

생성자

CodeDomProvider()

CodeDomProvider 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the CodeDomProvider class.

속성

CanRaiseEvents

구성 요소가 이벤트를 발생시킬 수 있는지 여부를 나타내는 값을 가져옵니다.Gets a value indicating whether the component can raise an event.

(다음에서 상속됨 Component)
Container

IContainer가 포함된 Component를 가져옵니다.Gets the IContainer that contains the Component.

(다음에서 상속됨 Component)
DesignMode

Component가 현재 디자인 모드인지 여부를 나타내는 값을 가져옵니다.Gets a value that indicates whether the Component is currently in design mode.

(다음에서 상속됨 Component)
Events

Component에 연결된 이벤트 처리기의 목록을 가져옵니다.Gets the list of event handlers that are attached to this Component.

(다음에서 상속됨 Component)
FileExtension

현재 언어의 소스 코드 파일에 사용할 기본 확장명을 가져옵니다.Gets the default file name extension to use for source code files in the current language.

LanguageOptions

언어 기능 식별자를 가져옵니다.Gets a language features identifier.

Site

ComponentISite를 가져오거나 설정합니다.Gets or sets the ISite of the Component.

(다음에서 상속됨 Component)

메서드

CompileAssemblyFromDom(CompilerParameters, CodeCompileUnit[])

지정된 컴파일러 설정을 사용하여 System.CodeDom 개체의 지정된 배열에 포함된 CodeCompileUnit 트리에 따라 어셈블리를 컴파일합니다.Compiles an assembly based on the System.CodeDom trees contained in the specified array of CodeCompileUnit objects, using the specified compiler settings.

CompileAssemblyFromFile(CompilerParameters, String[])

지정된 컴파일러 설정을 사용하여 지정된 파일에 포함된 소스 코드에서 어셈블리를 컴파일합니다.Compiles an assembly from the source code contained in the specified files, using the specified compiler settings.

CompileAssemblyFromSource(CompilerParameters, String[])

지정된 컴파일러 설정을 사용하여 소스 코드가 포함된 지정된 문자열 배열에서 어셈블리를 컴파일합니다.Compiles an assembly from the specified array of strings containing source code, using the specified compiler settings.

CreateCompiler()

파생 클래스에서 재정의될 때 새 코드 컴파일러를 만듭니다.When overridden in a derived class, creates a new code compiler.

CreateEscapedIdentifier(String)

지정된 값의 이스케이프된 식별자를 만듭니다.Creates an escaped identifier for the specified value.

CreateGenerator()

파생 클래스에서 재정의될 때 새 코드 생성기를 만듭니다.When overridden in a derived class, creates a new code generator.

CreateGenerator(String)

파생 클래스에서 재정의될 때 지정된 파일 이름을 출력으로 사용하여 새 코드 생성기를 만듭니다.When overridden in a derived class, creates a new code generator using the specified file name for output.

CreateGenerator(TextWriter)

파생 클래스에서 재정의될 때 지정된 TextWriter를 출력에 사용하여 새 코드 생성기를 만듭니다.When overridden in a derived class, creates a new code generator using the specified TextWriter for output.

CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(다음에서 상속됨 MarshalByRefObject)
CreateParser()

파생 클래스에서 재정의될 때 새 코드 파서를 만듭니다.When overridden in a derived class, creates a new code parser.

CreateProvider(String)

지정된 언어에 대한 CodeDomProvider 인스턴스를 가져옵니다.Gets a CodeDomProvider instance for the specified language.

CreateProvider(String, IDictionary<String,String>)

지정된 언어와 공급자 옵션에 대한 CodeDomProvider 인스턴스를 가져옵니다.Gets a CodeDomProvider instance for the specified language and provider options.

CreateValidIdentifier(String)

지정된 값의 유효한 식별자를 만듭니다.Creates a valid identifier for the specified value.

Dispose()

Component에서 사용하는 모든 리소스를 해제합니다.Releases all resources used by the Component.

(다음에서 상속됨 Component)
Dispose(Boolean)

Component에서 사용하는 관리되지 않는 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.Releases the unmanaged resources used by the Component and optionally releases the managed resources.

(다음에서 상속됨 Component)
Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(다음에서 상속됨 Object)
GenerateCodeFromCompileUnit(CodeCompileUnit, TextWriter, CodeGeneratorOptions)

지정된 CodeDOM(코드 문서 개체 모델) 컴파일 단위에 대한 코드를 생성한 다음 지정된 옵션을 사용하여 지정된 텍스트 작성기에 해당 코드를 보냅니다.Generates code for the specified Code Document Object Model (CodeDOM) compilation unit and sends it to the specified text writer, using the specified options.

GenerateCodeFromExpression(CodeExpression, TextWriter, CodeGeneratorOptions)

지정된 CodeDOM(코드 문서 개체 모델) 식에 대한 코드를 생성한 다음 지정된 옵션을 사용하여 지정된 텍스트 작성기에 해당 코드를 보냅니다.Generates code for the specified Code Document Object Model (CodeDOM) expression and sends it to the specified text writer, using the specified options.

GenerateCodeFromMember(CodeTypeMember, TextWriter, CodeGeneratorOptions)

지정된 CodeDOM(코드 문서 개체 모델) 멤버 선언에 대한 코드를 생성한 다음 지정된 옵션을 사용하여 지정된 텍스트 작성기에 해당 코드를 보냅니다.Generates code for the specified Code Document Object Model (CodeDOM) member declaration and sends it to the specified text writer, using the specified options.

GenerateCodeFromNamespace(CodeNamespace, TextWriter, CodeGeneratorOptions)

지정된 CodeDOM(코드 문서 개체 모델) 네임스페이스에 대한 코드를 생성한 다음 지정된 옵션을 사용하여 지정된 텍스트 작성기에 해당 코드를 보냅니다.Generates code for the specified Code Document Object Model (CodeDOM) namespace and sends it to the specified text writer, using the specified options.

GenerateCodeFromStatement(CodeStatement, TextWriter, CodeGeneratorOptions)

지정된 CodeDOM(코드 문서 개체 모델) 문에 대한 코드를 생성한 다음 지정된 옵션을 사용하여 지정된 텍스트 작성기에 해당 코드를 보냅니다.Generates code for the specified Code Document Object Model (CodeDOM) statement and sends it to the specified text writer, using the specified options.

GenerateCodeFromType(CodeTypeDeclaration, TextWriter, CodeGeneratorOptions)

지정된 CodeDOM(코드 문서 개체 모델) 형식 선언에 대한 코드를 생성한 다음 지정된 옵션을 사용하여 지정된 텍스트 작성기에 해당 코드를 보냅니다.Generates code for the specified Code Document Object Model (CodeDOM) type declaration and sends it to the specified text writer, using the specified options.

GetAllCompilerInfo()

이 컴퓨터의 언어 공급자 및 컴파일러 구성 설정을 반환합니다.Returns the language provider and compiler configuration settings for this computer.

GetCompilerInfo(String)

지정된 언어에 대한 언어 공급자 및 컴파일러 구성 설정을 반환합니다.Returns the language provider and compiler configuration settings for the specified language.

GetConverter(Type)

지정된 데이터 형식에 대한 TypeConverter를 가져옵니다.Gets a TypeConverter for the specified data type.

GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(다음에서 상속됨 Object)
GetLanguageFromExtension(String)

CodeDomProvider 컴파일러 구성 섹션에 구성되어 있는 대로, 지정된 파일 이름 확장명과 연결된 언어 이름을 반환합니다.Returns a language name associated with the specified file name extension, as configured in the CodeDomProvider compiler configuration section.

GetLifetimeService()

이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(다음에서 상속됨 MarshalByRefObject)
GetService(Type)

Component 또는 해당 Container에서 제공하는 서비스를 나타내는 개체를 반환합니다.Returns an object that represents a service provided by the Component or by its Container.

(다음에서 상속됨 Component)
GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(다음에서 상속됨 Object)
GetTypeOutput(CodeTypeReference)

지정된 CodeTypeReference에서 나타내는 형식을 가져옵니다.Gets the type indicated by the specified CodeTypeReference.

InitializeLifetimeService()

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.Obtains a lifetime service object to control the lifetime policy for this instance.

(다음에서 상속됨 MarshalByRefObject)
IsDefinedExtension(String)

파일 이름 확장명과 연결된 CodeDomProvider 구현이 컴퓨터에 구성되어 있는지 여부를 테스트합니다.Tests whether a file name extension has an associated CodeDomProvider implementation configured on the computer.

IsDefinedLanguage(String)

언어에 대한 CodeDomProvider 구현이 컴퓨터에 구성되어 있는지 여부를 테스트합니다.Tests whether a language has a CodeDomProvider implementation configured on the computer.

IsValidIdentifier(String)

지정된 값이 현재 언어에 유효한 식별자인지 여부를 나타내는 값을 반환합니다.Returns a value that indicates whether the specified value is a valid identifier for the current language.

MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.Creates a shallow copy of the current MarshalByRefObject object.

(다음에서 상속됨 MarshalByRefObject)
Parse(TextReader)

지정된 텍스트 스트림에서 읽은 코드를 CodeCompileUnit으로 컴파일합니다.Compiles the code read from the specified text stream into a CodeCompileUnit.

Supports(GeneratorSupport)

지정된 코드 생성이 지원되는지 여부를 나타내는 값을 반환합니다.Returns a value indicating whether the specified code generation support is provided.

ToString()

Component의 이름이 포함된 String을 반환합니다(있는 경우).Returns a String containing the name of the Component, if any. 이 메서드는 재정의할 수 없습니다.This method should not be overridden.

(다음에서 상속됨 Component)

이벤트

Disposed

Dispose() 메서드를 호출하여 구성 요소가 삭제되는 경우 발생합니다.Occurs when the component is disposed by a call to the Dispose() method.

(다음에서 상속됨 Component)

보안

LinkDemand
직접 실행 호출자의 경우 완전히 신뢰합니다.for full trust for the immediate caller. 이 클래스는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다.This class cannot be used by partially trusted code.

InheritanceDemand
상속자의 경우 완전히 신뢰합니다.for full trust for inheritors. 이 클래스는 부분적으로 신뢰할 수 있는 코드에서 상속할 수 없습니다.This class cannot be inherited by partially trusted code.

적용 대상

추가 정보