다음을 통해 공유


CallingConventions 열거형

열거형에 대한 유효한 호출 규칙을 정의합니다.

이 열거형에는 멤버 값를 비트로 조합할 수 있는 FlagsAttribute 특성이 있습니다.

네임스페이스: System.Reflection
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
<SerializableAttribute> _
<FlagsAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration CallingConventions
‘사용 방법
Dim instance As CallingConventions
[SerializableAttribute] 
[FlagsAttribute] 
[ComVisibleAttribute(true)] 
public enum CallingConventions
[SerializableAttribute] 
[FlagsAttribute] 
[ComVisibleAttribute(true)] 
public enum class CallingConventions
/** @attribute SerializableAttribute() */ 
/** @attribute FlagsAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public enum CallingConventions
SerializableAttribute 
FlagsAttribute 
ComVisibleAttribute(true) 
public enum CallingConventions

멤버

  멤버 이름 설명
Supported by the .NET Compact Framework Any Standard 또는 VarArgs 호출 규칙 중 사용할 수 있는 호출 규칙을 지정합니다. 
Supported by the .NET Compact Framework ExplicitThis 서명을 인스턴스 또는 가상 메서드(정적 메서드 아님)에 대한 호출을 나타내는 함수 포인터 서명으로 지정합니다. ExplicitThis를 설정하면 HasThis도 설정해야 합니다. 호출된 메서드에 전달된 첫 번째 인수는 this 포인터지만 이 인수의 형식은 알 수 없습니다. 그러므로 this 포인터의 형식 또는 클래스를 설명하는 토큰은 명시적으로 메타데이터 서명에 저장됩니다. 
Supported by the .NET Compact Framework HasThis 인스턴스 또는 가상 메서드(정적 메서드가 아님)를 지정합니다. 런타임에서, 호출된 메서드는 대상 개체를 가리키는 포인터에 첫 번째 인수(this 포인터)로 전달됩니다. 메서드를 알고 있고 메타데이터에서 소유자 클래스를 검색할 수 있으므로 메타데이터에 저장된 서명에는 이 첫 번째 인수의 형식이 포함되지 않습니다. 
Supported by the .NET Compact Framework Standard 공용 언어 런타임에서 결정한 대로 기본 호출 규칙을 지정합니다. 정적 메서드에는 이 호출 규칙을 사용하고, 인스턴스나 가상 메서드에는 HasThis를 사용합니다. 
Supported by the .NET Compact Framework VarArgs 가변 인수를 사용하여 메서드에 대한 호출 규칙을 지정합니다. 

설명

기본 호출 규칙은 컴파일된 메서드에 전달된 인수의 순서 및 레이아웃을 결정하는 규칙의 집합입니다. 또 이 규칙은 반환 값을 전달하는 방법, 인수에 사용할 레지스터 및 호출 메서드가 스택에서 인수를 제거할지 여부를 결정합니다.

예제

Public Class MyClass1
    Public Sub New(ByVal i As Integer)
    End Sub
    Public Shared Sub Main()
        Try
            Dim myType As Type = GetType(MyClass1)
            Dim types(0) As Type
            types(0) = GetType(Integer)
            ' Get the public instance constructor that takes an integer parameter.
            Dim constructorInfoObj As ConstructorInfo = _
                        myType.GetConstructor(BindingFlags.Instance Or _
                        BindingFlags.Public, Nothing, _
                        CallingConventions.HasThis, types, Nothing)
            If Not (constructorInfoObj Is Nothing) Then
                Console.WriteLine("The constructor of MyClass1 that " + _
                                  "is a public instance method and takes an " + _
                                  "integer as a parameter is: ")
                Console.WriteLine(constructorInfoObj.ToString())
            Else
                Console.WriteLine("The constructor MyClass1 that " + _
                                  "is a public instance method and takes an " + _
                                  "integer as a parameter is not available.")
            End If
        Catch e As ArgumentNullException
            Console.WriteLine("ArgumentNullException: " + e.Message)
        Catch e As ArgumentException
            Console.WriteLine("ArgumentException: " + e.Message)
        Catch e As SecurityException
            Console.WriteLine("SecurityException: " + e.Message)
        Catch e As Exception
            Console.WriteLine("Exception: " + e.Message)
        End Try
    End Sub
End Class
using System;
using System.Reflection;
using System.Security;

public class MyClass1
{
    public MyClass1(int i){}
    public static void Main()
    {
        try
        {
            Type  myType = typeof(MyClass1);
            Type[] types = new Type[1];
            types[0] = typeof(int);
            // Get the public instance constructor that takes an integer parameter.
            ConstructorInfo constructorInfoObj = myType.GetConstructor(
                BindingFlags.Instance | BindingFlags.Public, null,
                CallingConventions.HasThis, types, null);
            if(constructorInfoObj != null)
            {
                Console.WriteLine("The constructor of MyClass1 that is a public " +
                    "instance method and takes an integer as a parameter is: ");
                Console.WriteLine(constructorInfoObj.ToString());
            }
            else
            {
                Console.WriteLine("The constructor of MyClass1 that is a public instance " +
                    "method and takes an integer as a parameter is not available.");
            }
        }
        catch(ArgumentNullException e)
        {
            Console.WriteLine("ArgumentNullException: " + e.Message);
        }
        catch(ArgumentException e)
        {
            Console.WriteLine("ArgumentException: " + e.Message);
        }
        catch(SecurityException e)
        {
            Console.WriteLine("SecurityException: " + e.Message);
        }
        catch(Exception e)
        {
            Console.WriteLine("Exception: " + e.Message);
        }
    }
}
using namespace System;
using namespace System::Reflection;
using namespace System::Security;
public ref class MyClass1
{
public:
   MyClass1( int i ){}

};

int main()
{
   try
   {
      Type^ myType = MyClass1::typeid;
      array<Type^>^types = gcnew array<Type^>(1);
      types[ 0 ] = int::typeid;
      
      // Get the public instance constructor that takes an integer parameter.
      ConstructorInfo^ constructorInfoObj = myType->GetConstructor( static_cast<BindingFlags>(BindingFlags::Instance | BindingFlags::Public), nullptr, CallingConventions::HasThis, types, nullptr );
      if ( constructorInfoObj != nullptr )
      {
         Console::WriteLine( "The constructor of MyClass1 that is a public instance method and takes an integer as a parameter is: " );
         Console::WriteLine( constructorInfoObj );
      }
      else
      {
         Console::WriteLine( "The constructor of MyClass1 that is a public instance method and takes an integer as a parameter is not available." );
      }
   }
   catch ( ArgumentNullException^ e ) 
   {
      Console::WriteLine( "ArgumentNullException: {0}", e->Message );
   }
   catch ( ArgumentException^ e ) 
   {
      Console::WriteLine( "ArgumentException: {0}", e->Message );
   }
   catch ( SecurityException^ e ) 
   {
      Console::WriteLine( "SecurityException: {0}", e->Message );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception: {0}", e->Message );
   }
}
import System.*;
import System.Reflection.*;
import System.Security.*;

public class MyClass1
{
    public MyClass1(int i)
    {
    } //MyClass1

    public static void main(String[] args)
    {
        try {
            Type myType = MyClass1.class.ToType();
            Type types[] = new Type[1];
            types.set_Item(0, int.class.ToType());
            // Get the public instance constructor that takes an
            // integer parameter.
            ConstructorInfo constructorInfoObj =
                myType.GetConstructor(BindingFlags.Instance|BindingFlags.Public,
                null, CallingConventions.HasThis, types, null);
            if (constructorInfoObj != null) {
                Console.WriteLine("The constructor of MyClass1 that is a public "
                    + "instance method and takes an integer as a parameter is: ");
                Console.WriteLine(constructorInfoObj.ToString());
            }
            else {
                Console.WriteLine("The constructor of MyClass1 that is a "
                    + "public instance method and takes an integer "
                    + "as a parameter is not available.");
            }
        }
        catch (ArgumentNullException e) {
            Console.WriteLine("ArgumentNullException: " + e.get_Message());
        }
        catch (ArgumentException e) {
            Console.WriteLine("ArgumentException: " + e.get_Message());
        }
        catch (SecurityException e) {
            Console.WriteLine("SecurityException: " + e.get_Message());
        }
        catch (System.Exception e) {
            Console.WriteLine("Exception: " + e.get_Message());
        }
    } //main
} //MyClass1

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

System.Reflection 네임스페이스