DynamicMethod 클래스

정의

컴파일, 실행 및 삭제할 수 있는 동적 메서드를 정의하고 나타냅니다. 삭제된 메서드는 가비지 수집에 사용할 수 있습니다.

public ref class DynamicMethod sealed : System::Reflection::MethodInfo
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class DynamicMethod : System.Reflection.MethodInfo
public sealed class DynamicMethod : System.Reflection.MethodInfo
[<System.Runtime.InteropServices.ComVisible(true)>]
type DynamicMethod = class
    inherit MethodInfo
type DynamicMethod = class
    inherit MethodInfo
Public NotInheritable Class DynamicMethod
Inherits MethodInfo
상속
특성

예제

다음 코드 예제에서는 두 개의 매개 변수를 사용하는 동적 메서드를 만듭니다. 이 예제에서는 첫 번째 매개 변수를 콘솔에 출력하는 간단한 함수 본문을 내보내고 두 번째 매개 변수를 메서드의 반환 값으로 사용합니다. 이 예제는 대리자를 생성하여 메서드를 완성한 후, 다른 매개변수로 대리자를 호출하고, 마지막으로 Invoke 메서드를 사용하여 동적 메서드를 호출합니다.

using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Globalization;

public class Test
{
    // Declare a delegate type that can be used to execute the completed
    // dynamic method.
    private delegate int HelloDelegate(string msg, int ret);

    public static void Main()
    {
        // Create an array that specifies the types of the parameters
        // of the dynamic method. This dynamic method has a String
        // parameter and an Integer parameter.
        Type[] helloArgs = {typeof(string), typeof(int)};

        // Create a dynamic method with the name "Hello", a return type
        // of Integer, and two parameters whose types are specified by
        // the array helloArgs. Create the method in the module that
        // defines the String class.
        DynamicMethod hello = new DynamicMethod("Hello",
            typeof(int),
            helloArgs,
            typeof(string).Module);

        // Create an array that specifies the parameter types of the
        // overload of Console.WriteLine to be used in Hello.
        Type[] writeStringArgs = {typeof(string)};
        // Get the overload of Console.WriteLine that has one
        // String parameter.
        MethodInfo writeString = typeof(Console).GetMethod("WriteLine",
            writeStringArgs);

        // Get an ILGenerator and emit a body for the dynamic method,
        // using a stream size larger than the IL that will be
        // emitted.
        ILGenerator il = hello.GetILGenerator(256);
        // Load the first argument, which is a string, onto the stack.
        il.Emit(OpCodes.Ldarg_0);
        // Call the overload of Console.WriteLine that prints a string.
        il.EmitCall(OpCodes.Call, writeString, null);
        // The Hello method returns the value of the second argument;
        // to do this, load the onto the stack and return.
        il.Emit(OpCodes.Ldarg_1);
        il.Emit(OpCodes.Ret);

        // Add parameter information to the dynamic method. (This is not
        // necessary, but can be useful for debugging.) For each parameter,
        // identified by position, supply the parameter attributes and a
        // parameter name.
        hello.DefineParameter(1, ParameterAttributes.In, "message");
        hello.DefineParameter(2, ParameterAttributes.In, "valueToReturn");

        // Create a delegate that represents the dynamic method. This
        // action completes the method. Any further attempts to
        // change the method are ignored.
        HelloDelegate hi =
            (HelloDelegate) hello.CreateDelegate(typeof(HelloDelegate));

        // Use the delegate to execute the dynamic method.
        Console.WriteLine("\r\nUse the delegate to execute the dynamic method:");
        int retval = hi("\r\nHello, World!", 42);
        Console.WriteLine("Invoking delegate hi(\"Hello, World!\", 42) returned: " + retval);

        // Execute it again, with different arguments.
        retval = hi("\r\nHi, Mom!", 5280);
        Console.WriteLine("Invoking delegate hi(\"Hi, Mom!\", 5280) returned: " + retval);

        Console.WriteLine("\r\nUse the Invoke method to execute the dynamic method:");
        // Create an array of arguments to use with the Invoke method.
        object[] invokeArgs = {"\r\nHello, World!", 42};
        // Invoke the dynamic method using the arguments. This is much
        // slower than using the delegate, because you must create an
        // array to contain the arguments, and value-type arguments
        // must be boxed.
        object objRet = hello.Invoke(null, BindingFlags.ExactBinding, null, invokeArgs, new CultureInfo("en-us"));
        Console.WriteLine("hello.Invoke returned: " + objRet);

        Console.WriteLine("\r\n ----- Display information about the dynamic method -----");
        // Display MethodAttributes for the dynamic method, set when
        // the dynamic method was created.
        Console.WriteLine("\r\nMethod Attributes: {0}", hello.Attributes);

        // Display the calling convention of the dynamic method, set when the
        // dynamic method was created.
        Console.WriteLine("\r\nCalling convention: {0}", hello.CallingConvention);

        // Display the declaring type, which is always null for dynamic
        // methods.
        if (hello.DeclaringType == null)
        {
            Console.WriteLine("\r\nDeclaringType is always null for dynamic methods.");
        }
        else
        {
            Console.WriteLine("DeclaringType: {0}", hello.DeclaringType);
        }

        // Display the default value for InitLocals.
        if (hello.InitLocals)
        {
            Console.Write("\r\nThis method contains verifiable code.");
        }
        else
        {
            Console.Write("\r\nThis method contains unverifiable code.");
        }
        Console.WriteLine(" (InitLocals = {0})", hello.InitLocals);

        // Display the module specified when the dynamic method was created.
        Console.WriteLine("\r\nModule: {0}", hello.Module);

        // Display the name specified when the dynamic method was created.
        // Note that the name can be blank.
        Console.WriteLine("\r\nName: {0}", hello.Name);

        // For dynamic methods, the reflected type is always null.
        if (hello.ReflectedType == null)
        {
            Console.WriteLine("\r\nReflectedType is null.");
        }
        else
        {
            Console.WriteLine("\r\nReflectedType: {0}", hello.ReflectedType);
        }

        if (hello.ReturnParameter == null)
        {
            Console.WriteLine("\r\nMethod has no return parameter.");
        }
        else
        {
            Console.WriteLine("\r\nReturn parameter: {0}", hello.ReturnParameter);
        }

        // If the method has no return type, ReturnType is System.Void.
        Console.WriteLine("\r\nReturn type: {0}", hello.ReturnType);

        // ReturnTypeCustomAttributes returns an ICustomeAttributeProvider
        // that can be used to enumerate the custom attributes of the
        // return value. At present, there is no way to set such custom
        // attributes, so the list is empty.
        if (hello.ReturnType == typeof(void))
        {
            Console.WriteLine("The method has no return type.");
        }
        else
        {
            ICustomAttributeProvider caProvider = hello.ReturnTypeCustomAttributes;
            object[] returnAttributes = caProvider.GetCustomAttributes(true);
            if (returnAttributes.Length == 0)
            {
                Console.WriteLine("\r\nThe return type has no custom attributes.");
            }
            else
            {
                Console.WriteLine("\r\nThe return type has the following custom attributes:");
                foreach( object attr in returnAttributes )
                {
                    Console.WriteLine("\t{0}", attr.ToString());
                }
            }
        }

        Console.WriteLine("\r\nToString: {0}", hello.ToString());

        // Display parameter information.
        ParameterInfo[] parameters = hello.GetParameters();
        Console.WriteLine("\r\nParameters: name, type, ParameterAttributes");
        foreach( ParameterInfo p in parameters )
        {
            Console.WriteLine("\t{0}, {1}, {2}",
                p.Name, p.ParameterType, p.Attributes);
        }
    }
}

/* This code example produces the following output:

Use the delegate to execute the dynamic method:

Hello, World!
Invoking delegate hi("Hello, World!", 42) returned: 42

Hi, Mom!
Invoking delegate hi("Hi, Mom!", 5280) returned: 5280

Use the Invoke method to execute the dynamic method:

Hello, World!
hello.Invoke returned: 42

 ----- Display information about the dynamic method -----

Method Attributes: PrivateScope, Public, Static

Calling convention: Standard

DeclaringType is always null for dynamic methods.

This method contains verifiable code. (InitLocals = True)

Module: CommonLanguageRuntimeLibrary

Name: Hello

ReflectedType is null.

Method has no return parameter.

Return type: System.Int32

The return type has no custom attributes.

ToString: Int32 Hello(System.String, Int32)

Parameters: name, type, ParameterAttributes
        message, System.String, In
        valueToReturn, System.Int32, In
 */
Imports System.Reflection
Imports System.Reflection.Emit
Imports System.Globalization

Public Class Test
    ' Declare a delegate type that can be used to execute the completed
    ' dynamic method. 
    Private Delegate Function HelloDelegate(ByVal msg As String, _
        ByVal ret As Integer) As Integer

    Public Shared Sub Main()
        ' Create an array that specifies the types of the parameters
        ' of the dynamic method. This dynamic method has a String
        ' parameter and an Integer parameter.
        Dim helloArgs() As Type = {GetType(String), GetType(Integer)}

        ' Create a dynamic method with the name "Hello", a return type
        ' of Integer, and two parameters whose types are specified by
        ' the array helloArgs. Create the method in the module that
        ' defines the String class.
        Dim hello As New DynamicMethod("Hello", _
            GetType(Integer), _
            helloArgs, _
            GetType(String).Module)

        ' Create an array that specifies the parameter types of the
        ' overload of Console.WriteLine to be used in Hello.
        Dim writeStringArgs() As Type = {GetType(String)}
        ' Get the overload of Console.WriteLine that has one
        ' String parameter.
        Dim writeString As MethodInfo = GetType(Console). _
            GetMethod("WriteLine", writeStringArgs) 

        ' Get an ILGenerator and emit a body for the dynamic method,
        ' using a stream size larger than the IL that will be
        ' emitted.
        Dim il As ILGenerator = hello.GetILGenerator(256)
        ' Load the first argument, which is a string, onto the stack.
        il.Emit(OpCodes.Ldarg_0)
        ' Call the overload of Console.WriteLine that prints a string.
        il.EmitCall(OpCodes.Call, writeString, Nothing)
        ' The Hello method returns the value of the second argument;
        ' to do this, load the onto the stack and return.
        il.Emit(OpCodes.Ldarg_1)
        il.Emit(OpCodes.Ret)

        ' Add parameter information to the dynamic method. (This is not
        ' necessary, but can be useful for debugging.) For each parameter,
        ' identified by position, supply the parameter attributes and a 
        ' parameter name.
        hello.DefineParameter(1, ParameterAttributes.In, "message")
        hello.DefineParameter(2, ParameterAttributes.In, "valueToReturn")

        ' Create a delegate that represents the dynamic method. This
        ' action completes the method. Any further attempts to
        ' change the method are ignored.
    Dim hi As HelloDelegate = _
            CType(hello.CreateDelegate(GetType(HelloDelegate)), HelloDelegate)

        ' Use the delegate to execute the dynamic method.
        Console.WriteLine(vbCrLf & "Use the delegate to execute the dynamic method:")
        Dim retval As Integer = hi(vbCrLf & "Hello, World!", 42)
        Console.WriteLine("Invoking delegate hi(""Hello, World!"", 42) returned: " _
            & retval & ".")

        ' Execute it again, with different arguments.
        retval = hi(vbCrLf & "Hi, Mom!", 5280)
        Console.WriteLine("Invoking delegate hi(""Hi, Mom!"", 5280) returned: " _
            & retval & ".")

        Console.WriteLine(vbCrLf & "Use the Invoke method to execute the dynamic method:")
        ' Create an array of arguments to use with the Invoke method.
        Dim invokeArgs() As Object = {vbCrLf & "Hello, World!", 42}
        ' Invoke the dynamic method using the arguments. This is much
        ' slower than using the delegate, because you must create an
        ' array to contain the arguments, and value-type arguments
        ' must be boxed.
        Dim objRet As Object = hello.Invoke(Nothing, _
            BindingFlags.ExactBinding, Nothing, invokeArgs, _
            New CultureInfo("en-us"))
        Console.WriteLine("hello.Invoke returned: {0}", objRet)

        Console.WriteLine(vbCrLf & _
            " ----- Display information about the dynamic method -----")
        ' Display MethodAttributes for the dynamic method, set when 
        ' the dynamic method was created.
        Console.WriteLine(vbCrLf & "Method Attributes: {0}", _
            hello.Attributes)

        ' Display the calling convention of the dynamic method, set when the 
        ' dynamic method was created.
        Console.WriteLine(vbCrLf & "Calling convention: {0}", _ 
            hello.CallingConvention)

        ' Display the declaring type, which is always Nothing for dynamic
        ' methods.
        If hello.DeclaringType Is Nothing Then
            Console.WriteLine(vbCrLf & "DeclaringType is always Nothing for dynamic methods.")
        Else
            Console.WriteLine("DeclaringType: {0}", hello.DeclaringType)
        End If

        ' Display the default value for InitLocals.
        If hello.InitLocals Then
            Console.Write(vbCrLf & "This method contains verifiable code.")
        Else
            Console.Write(vbCrLf & "This method contains unverifiable code.")
        End If
        Console.WriteLine(" (InitLocals = {0})", hello.InitLocals)

        ' Display the module specified when the dynamic method was created.
        Console.WriteLine(vbCrLf & "Module: {0}", hello.Module)

        ' Display the name specified when the dynamic method was created.
        ' Note that the name can be blank.
        Console.WriteLine(vbCrLf & "Name: {0}", hello.Name)

        ' For dynamic methods, the reflected type is always Nothing.
        If hello.ReflectedType Is Nothing Then
            Console.WriteLine(vbCrLf & "ReflectedType is Nothing.")
        Else
            Console.WriteLine(vbCrLf & "ReflectedType: {0}", _
                hello.ReflectedType)
        End If

        If hello.ReturnParameter Is Nothing Then
            Console.WriteLine(vbCrLf & "Method has no return parameter.")
        Else
            Console.WriteLine(vbCrLf & "Return parameter: {0}", _
                hello.ReturnParameter)
        End If

        ' If the method has no return type, ReturnType is System.Void.
        Console.WriteLine(vbCrLf & "Return type: {0}", hello.ReturnType)           

        ' ReturnTypeCustomAttributes returns an ICustomeAttributeProvider
        ' that can be used to enumerate the custom attributes of the
        ' return value. At present, there is no way to set such custom
        ' attributes, so the list is empty.
        If hello.ReturnType Is GetType(System.Void) Then
            Console.WriteLine("The method has no return type.")
        Else
            Dim caProvider As ICustomAttributeProvider = _
                hello.ReturnTypeCustomAttributes
            Dim returnAttributes() As Object = _
                caProvider.GetCustomAttributes(True)
            If returnAttributes.Length = 0 Then
                Console.WriteLine(vbCrLf _
                    & "The return type has no custom attributes.")
            Else
                Console.WriteLine(vbCrLf _
                    & "The return type has the following custom attributes:")
                For Each attr As Object In returnAttributes
                    Console.WriteLine(vbTab & attr.ToString())
                Next attr
            End If
        End If

        Console.WriteLine(vbCrLf & "ToString: " & hello.ToString())

        ' Display parameter information.
        Dim parameters() As ParameterInfo = hello.GetParameters()
        Console.WriteLine(vbCrLf & "Parameters: name, type, ParameterAttributes")
        For Each p As ParameterInfo In parameters
            Console.WriteLine(vbTab & "{0}, {1}, {2}", _ 
                p.Name, p.ParameterType, p.Attributes)
        Next p
    End Sub
End Class

' This code example produces the following output:
'
'Use the delegate to execute the dynamic method:
'
'Hello, World!
'Invoking delegate hi("Hello, World!", 42) returned: 42.
'
'Hi, Mom!
'Invoking delegate hi("Hi, Mom!", 5280) returned: 5280.
'
'Use the Invoke method to execute the dynamic method:
'
'Hello, World!
'hello.Invoke returned: 42
'
' ----- Display information about the dynamic method -----
'
'Method Attributes: PrivateScope, Public, Static
'
'Calling convention: Standard
'
'DeclaringType is always Nothing for dynamic methods.
'
'This method contains verifiable code. (InitLocals = True)
'
'Module: CommonLanguageRuntimeLibrary
'
'Name: Hello
'
'ReflectedType is Nothing.
'
'Method has no return parameter.
'
'Return type: System.Int32
'
'The return type has no custom attributes.
'
'ToString: Int32 Hello(System.String, Int32)
'
'Parameters: name, type, ParameterAttributes
'        message, System.String, In
'        valueToReturn, System.Int32, In

설명

이 API에 대한 자세한 내용은 DynamicMethod에 대한 추가 API 비고를 참조하세요.

생성자

Name Description
DynamicMethod(String, MethodAttributes, CallingConventions, Type, Type[], Module, Boolean)

메서드 이름, 특성, 호출 규칙, 반환 형식, 매개 변수 형식, 모듈을 지정하고 동적 메서드의 MSIL(Microsoft 중간 언어)에서 액세스하는 형식 및 멤버에 대해 JIT(Just-In-Time) 표시 여부를 지정하여 모듈에 전역적인 동적 메서드를 만듭니다.

DynamicMethod(String, MethodAttributes, CallingConventions, Type, Type[], Type, Boolean)

메서드 이름, 특성, 호출 규칙, 반환 형식, 매개 변수 형식, 동적 메서드가 논리적으로 연결된 형식 및 동적 메서드의 MSIL(Microsoft 중간 언어)에서 액세스하는 형식 및 멤버에 대해 JIT(Just-In-Time) 표시 여부를 지정하는 동적 메서드를 만듭니다.

DynamicMethod(String, Type, Type[], Boolean)

메서드 이름, 반환 형식, 매개 변수 형식 및 동적 메서드의 MSIL(Microsoft 중간 언어)에서 액세스하는 형식 및 멤버에 대해 JIT(Just-In-Time) 표시 여부를 지정하여 익명으로 호스트되는 동적 메서드를 초기화합니다.

DynamicMethod(String, Type, Type[], Module, Boolean)

메서드 이름, 반환 형식, 매개 변수 형식, 모듈 및 동적 메서드의 MSIL(Microsoft 중간 언어)에서 액세스하는 형식 및 멤버에 대해 JIT(Just-In-Time) 표시 여부를 지정하여 모듈에 전역적인 동적 메서드를 만듭니다.

DynamicMethod(String, Type, Type[], Module)

메서드 이름, 반환 형식, 매개 변수 형식 및 모듈을 지정하여 모듈에 전역적인 동적 메서드를 만듭니다.

DynamicMethod(String, Type, Type[], Type, Boolean)

메서드 이름, 반환 형식, 매개 변수 형식, 동적 메서드가 논리적으로 연결된 형식 및 동적 메서드의 MSIL(Microsoft 중간 언어)에서 액세스하는 형식 및 멤버에 대해 JIT(Just-In-Time) 표시 여부를 지정하는 동적 메서드를 만듭니다.

DynamicMethod(String, Type, Type[], Type)

메서드 이름, 반환 형식, 매개 변수 형식 및 동적 메서드가 논리적으로 연결된 형식을 지정하는 동적 메서드를 만듭니다.

DynamicMethod(String, Type, Type[])

메서드 이름, 반환 형식 및 매개 변수 형식을 지정하여 익명으로 호스트되는 동적 메서드를 초기화합니다.

속성

Name Description
Attributes

동적 메서드를 만들 때 지정된 특성을 가져옵니다.

CallingConvention

동적 메서드를 만들 때 지정된 호출 규칙을 가져옵니다.

ContainsGenericParameters

제네릭 메서드에 할당되지 않은 제네릭 형식 매개 변수가 포함되어 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodInfo)
CustomAttributes

이 멤버의 사용자 지정 특성을 포함하는 컬렉션을 가져옵니다.

(다음에서 상속됨 MemberInfo)
DeclaringType

항상 null 동적 메서드에 대한 메서드를 선언하는 형식을 가져옵니다.

InitLocals

메서드의 지역 변수가 0으로 초기화되었는지 여부를 나타내는 값을 가져오거나 설정합니다.

IsAbstract

메서드가 추상인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodBase)
IsAssembly

이 메서드 또는 생성자의 Assembly잠재적 표시 여부를 나타내는 값을 가져옵니다. 즉, 메서드 또는 생성자가 동일한 어셈블리의 다른 형식에 가장 많이 표시되며 어셈블리 외부의 파생 형식에는 표시되지 않습니다.

(다음에서 상속됨 MethodBase)
IsConstructedGenericMethod

컴파일, 실행 및 삭제할 수 있는 동적 메서드를 정의하고 나타냅니다. 삭제된 메서드는 가비지 수집에 사용할 수 있습니다.

(다음에서 상속됨 MethodBase)
IsConstructor

메서드가 생성자인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodBase)
IsFamily

이 메서드 또는 생성자의 Family표시 여부를 나타내는 값을 가져옵니다. 즉, 메서드 또는 생성자가 해당 클래스 및 파생 클래스 내에서만 표시됩니다.

(다음에서 상속됨 MethodBase)
IsFamilyAndAssembly

이 메서드 또는 생성자의 FamANDAssem표시 여부를 나타내는 값을 가져옵니다. 즉, 메서드 또는 생성자는 파생 클래스에서 호출할 수 있지만 동일한 어셈블리에 있는 경우에만 호출할 수 있습니다.

(다음에서 상속됨 MethodBase)
IsFamilyOrAssembly

이 메서드 또는 생성자의 FamORAssem잠재적 표시 여부를 나타내는 값을 가져옵니다. 즉, 메서드 또는 생성자가 어디에 있든 파생 클래스 및 동일한 어셈블리의 클래스에서 호출할 수 있습니다.

(다음에서 상속됨 MethodBase)
IsFinal

이 메서드 final가 .인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodBase)
IsGenericMethod

현재 메서드가 제네릭 메서드인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodInfo)
IsGenericMethodDefinition

현재 MethodInfo 가 제네릭 메서드의 정의를 나타내는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodInfo)
IsHideBySig

정확히 동일한 시그니처를 가진 동일한 종류의 멤버만 파생 클래스에 숨겨져 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodBase)
IsPrivate

이 멤버가 프라이빗인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodBase)
IsPublic

public 메서드인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodBase)
IsSecurityCritical

현재 동적 메서드가 보안에 중요하거나 보안이 안전한지 여부를 나타내는 값을 가져오므로 중요한 작업을 수행할 수 있습니다.

IsSecurityCritical

현재 메서드 또는 생성자가 현재 신뢰 수준에서 보안에 중요하거나 보안이 안전한지 여부를 나타내는 값을 가져오므로 중요한 작업을 수행할 수 있습니다.

(다음에서 상속됨 MethodBase)
IsSecuritySafeCritical

현재 동적 메서드가 현재 신뢰 수준에서 보안에 중요한지 여부를 나타내는 값을 가져옵니다. 즉, 중요한 작업을 수행할 수 있고 투명 코드로 액세스할 수 있는지 여부입니다.

IsSecuritySafeCritical

현재 메서드 또는 생성자가 현재 신뢰 수준에서 보안에 중요한지 여부를 나타내는 값을 가져옵니다. 즉, 중요한 작업을 수행할 수 있고 투명 코드로 액세스할 수 있는지 여부입니다.

(다음에서 상속됨 MethodBase)
IsSecurityTransparent

현재 동적 메서드가 현재 신뢰 수준에서 투명하므로 중요한 작업을 수행할 수 없는지 여부를 나타내는 값을 가져옵니다.

IsSecurityTransparent

현재 메서드 또는 생성자가 현재 신뢰 수준에서 투명하므로 중요한 작업을 수행할 수 없는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodBase)
IsSpecialName

이 메서드에 특별한 이름이 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodBase)
IsStatic

메서드 static가 .인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodBase)
IsVirtual

메서드 virtual가 .인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodBase)
MemberType

이 멤버가 MemberTypes 메서드임을 나타내는 값을 가져옵니다.

(다음에서 상속됨 MethodInfo)
MetadataToken

메타데이터 요소를 식별하는 값을 가져옵니다.

(다음에서 상속됨 MemberInfo)
MethodHandle

동적 메서드에 대해서는 지원되지 않습니다.

MethodImplementationFlags

메서드 구현의 MethodImplAttributes 특성을 지정하는 플래그를 가져옵니다.

(다음에서 상속됨 MethodBase)
Module

동적 메서드가 논리적으로 연결된 모듈을 가져옵니다.

Module

현재 MemberInfo 가 나타내는 멤버를 선언하는 형식이 정의된 모듈을 가져옵니다.

(다음에서 상속됨 MemberInfo)
Name

동적 메서드의 이름을 가져옵니다.

ReflectedType

리플렉션에서 메서드를 가져오는 데 사용된 클래스를 가져옵니다.

ReturnParameter

동적 메서드의 반환 매개 변수를 가져옵니다.

ReturnType

동적 메서드의 반환 값 형식을 가져옵니다.

ReturnTypeCustomAttributes

동적 메서드에 대한 반환 형식의 사용자 지정 특성을 가져옵니다.

메서드

Name Description
CreateDelegate(Type, Object)

동적 메서드를 완료하고 대리자를 실행하는 데 사용할 수 있는 대리자를 만들고 대리자가 바인딩된 대리자 형식과 개체를 지정합니다.

CreateDelegate(Type)

동적 메서드를 완료하고 실행하는 데 사용할 수 있는 대리자를 만듭니다.

DefineParameter(Int32, ParameterAttributes, String)

동적 메서드의 매개 변수를 정의합니다.

Equals(Object)

이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 MethodInfo)
GetBaseDefinition()

메서드의 기본 구현을 반환합니다.

GetCustomAttributes(Boolean)

메서드에 대해 정의된 모든 사용자 지정 특성을 반환합니다.

GetCustomAttributes(Type, Boolean)

메서드에 적용된 지정된 형식의 사용자 지정 특성을 반환합니다.

GetCustomAttributesData()

대상 멤버에 적용된 특성에 대한 데이터를 나타내는 개체 목록을 CustomAttributeData 반환합니다.

(다음에서 상속됨 MemberInfo)
GetDynamicILInfo()

메타데이터 토큰, 범위 및 MSIL(Microsoft 중간 언어) 스트림에서 메서드 본문을 생성하는 데 사용할 수 있는 DynamicILInfo 개체를 반환합니다.

GetGenericArguments()

제네릭 메서드의 Type 형식 인수 또는 제네릭 메서드 정의의 형식 매개 변수를 나타내는 개체의 배열을 반환합니다.

(다음에서 상속됨 MethodInfo)
GetGenericMethodDefinition()

현재 메서드를 MethodInfo 생성할 수 있는 제네릭 메서드 정의를 나타내는 개체를 반환합니다.

(다음에서 상속됨 MethodInfo)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 MethodInfo)
GetILGenerator()

기본 MSIL 스트림 크기가 64바이트인 메서드의 Microsoft 중간 언어(MSIL) 생성기를 반환합니다.

GetILGenerator(Int32)

지정된 MSIL 스트림 크기의 메서드에 대한 Microsoft MSIL(중간 언어) 생성기를 반환합니다.

GetMethodBody()

파생 클래스에서 재정의되는 경우 현재 메서드에 대한 MSIL 스트림, 지역 변수 및 예외에 대한 액세스를 제공하는 개체를 가져옵니다 MethodBody .

(다음에서 상속됨 MethodBase)
GetMethodImplementationFlags()

메서드의 구현 플래그를 반환합니다.

GetParameters()

동적 메서드의 매개 변수를 반환합니다.

HasSameMetadataDefinitionAs(MemberInfo)

컴파일, 실행 및 삭제할 수 있는 동적 메서드를 정의하고 나타냅니다. 삭제된 메서드는 가비지 수집에 사용할 수 있습니다.

(다음에서 상속됨 MemberInfo)
Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)

지정된 문화권 정보와 함께 지정된 바인더의 제약 조건 하에서 지정된 매개 변수를 사용하여 동적 메서드를 호출합니다.

IsDefined(Type, Boolean)

지정된 사용자 지정 특성 형식이 정의되어 있는지 여부를 나타냅니다.

MakeGenericMethod(Type[])

현재 제네릭 메서드 정의의 형식 매개 변수에 대한 형식 배열의 요소를 대체하고 생성된 생성된 메서드를 나타내는 개체를 반환 MethodInfo 합니다.

(다음에서 상속됨 MethodInfo)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

문자열로 표시되는 메서드의 시그니처를 반환합니다.

명시적 인터페이스 구현

Name Description
_MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 MemberInfo)
_MemberInfo.GetType()

클래스를 Type 나타내는 개체를 MemberInfo 가져옵니다.

(다음에서 상속됨 MemberInfo)
_MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 MemberInfo)
_MemberInfo.GetTypeInfoCount(UInt32)

개체가 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 MemberInfo)
_MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에 의해 노출되는 속성 및 메서드에 대한 액세스를 제공합니다.

(다음에서 상속됨 MemberInfo)
_MethodBase.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 MethodBase)
_MethodBase.GetType()

이 멤버에 대한 설명은 을 참조하세요 GetType().

(다음에서 상속됨 MethodBase)
_MethodBase.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 MethodBase)
_MethodBase.GetTypeInfoCount(UInt32)

개체가 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 MethodBase)
_MethodBase.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에 의해 노출되는 속성 및 메서드에 대한 액세스를 제공합니다.

(다음에서 상속됨 MethodBase)
_MethodBase.IsAbstract

이 멤버에 대한 설명은 을 참조하세요 IsAbstract.

(다음에서 상속됨 MethodBase)
_MethodBase.IsAssembly

이 멤버에 대한 설명은 을 참조하세요 IsAssembly.

(다음에서 상속됨 MethodBase)
_MethodBase.IsConstructor

이 멤버에 대한 설명은 을 참조하세요 IsConstructor.

(다음에서 상속됨 MethodBase)
_MethodBase.IsFamily

이 멤버에 대한 설명은 을 참조하세요 IsFamily.

(다음에서 상속됨 MethodBase)
_MethodBase.IsFamilyAndAssembly

이 멤버에 대한 설명은 을 참조하세요 IsFamilyAndAssembly.

(다음에서 상속됨 MethodBase)
_MethodBase.IsFamilyOrAssembly

이 멤버에 대한 설명은 을 참조하세요 IsFamilyOrAssembly.

(다음에서 상속됨 MethodBase)
_MethodBase.IsFinal

이 멤버에 대한 설명은 을 참조하세요 IsFinal.

(다음에서 상속됨 MethodBase)
_MethodBase.IsHideBySig

이 멤버에 대한 설명은 을 참조하세요 IsHideBySig.

(다음에서 상속됨 MethodBase)
_MethodBase.IsPrivate

이 멤버에 대한 설명은 을 참조하세요 IsPrivate.

(다음에서 상속됨 MethodBase)
_MethodBase.IsPublic

이 멤버에 대한 설명은 을 참조하세요 IsPublic.

(다음에서 상속됨 MethodBase)
_MethodBase.IsSpecialName

이 멤버에 대한 설명은 을 참조하세요 IsSpecialName.

(다음에서 상속됨 MethodBase)
_MethodBase.IsStatic

이 멤버에 대한 설명은 을 참조하세요 IsStatic.

(다음에서 상속됨 MethodBase)
_MethodBase.IsVirtual

이 멤버에 대한 설명은 을 참조하세요 IsVirtual.

(다음에서 상속됨 MethodBase)
_MethodInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 MethodInfo)
_MethodInfo.GetType()

COM에서 메서드에 GetType() 대한 액세스를 제공합니다.

(다음에서 상속됨 MethodInfo)
_MethodInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 MethodInfo)
_MethodInfo.GetTypeInfoCount(UInt32)

개체가 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 MethodInfo)
_MethodInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에 의해 노출되는 속성 및 메서드에 대한 액세스를 제공합니다.

(다음에서 상속됨 MethodInfo)

확장명 메서드

Name Description
GetCustomAttribute(MemberInfo, Type, Boolean)

지정된 멤버에 적용되는 지정된 형식의 사용자 지정 특성을 검색하고 필요에 따라 해당 멤버의 상위 항목을 검사합니다.

GetCustomAttribute(MemberInfo, Type)

지정된 멤버에 적용되는 지정된 형식의 사용자 지정 특성을 검색합니다.

GetCustomAttribute<T>(MemberInfo, Boolean)

지정된 멤버에 적용되는 지정된 형식의 사용자 지정 특성을 검색하고 필요에 따라 해당 멤버의 상위 항목을 검사합니다.

GetCustomAttribute<T>(MemberInfo)

지정된 멤버에 적용되는 지정된 형식의 사용자 지정 특성을 검색합니다.

GetCustomAttributes(MemberInfo, Boolean)

지정된 멤버에 적용되는 사용자 지정 특성의 컬렉션을 검색하고 필요에 따라 해당 멤버의 상위 항목을 검사합니다.

GetCustomAttributes(MemberInfo, Type, Boolean)

지정된 멤버에 적용되는 지정된 형식의 사용자 지정 특성 컬렉션을 검색하고 필요에 따라 해당 멤버의 상위 항목을 검사합니다.

GetCustomAttributes(MemberInfo, Type)

지정된 멤버에 적용되는 지정된 형식의 사용자 지정 특성 컬렉션을 검색합니다.

GetCustomAttributes(MemberInfo)

지정된 멤버에 적용되는 사용자 지정 특성의 컬렉션을 검색합니다.

GetCustomAttributes<T>(MemberInfo, Boolean)

지정된 멤버에 적용되는 지정된 형식의 사용자 지정 특성 컬렉션을 검색하고 필요에 따라 해당 멤버의 상위 항목을 검사합니다.

GetCustomAttributes<T>(MemberInfo)

지정된 멤버에 적용되는 지정된 형식의 사용자 지정 특성 컬렉션을 검색합니다.

GetRuntimeBaseDefinition(MethodInfo)

메서드가 처음 선언된 직접 또는 간접 기본 클래스에서 지정된 메서드를 나타내는 개체를 검색합니다.

IsDefined(MemberInfo, Type, Boolean)

지정된 형식의 사용자 지정 특성이 지정된 멤버에 적용되는지 여부와 필요에 따라 상위 항목에 적용되는지 여부를 나타냅니다.

IsDefined(MemberInfo, Type)

지정된 형식의 사용자 지정 특성이 지정된 멤버에 적용되는지 여부를 나타냅니다.

적용 대상

추가 정보