CallingConventions 列挙体とは? わかりやすく解説

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
メンバメンバ
 メンバ説明
.NET Compact Framework によるサポートAnyStandard または VarArgsいずれか呼び出し規約使用することを指定します。 
.NET Compact Framework によるサポートExplicitThisシグネチャが、インスタンスまたは仮想メソッド (非静的メソッド) への呼び出しを表す関数ポインタ シグネチャであることを示しますExplicitThis設定されている場合HasThis設定する必要があります呼び出されるメソッド渡される最初引数this ポインタのままですが、その引数の型は不明になります。したがってthis ポインタの型 (またはクラス) を記述するトークンが、そのメタデータ シグネチャ明示的に格納されます。 
.NET Compact Framework によるサポートHasThisインスタンスまたは仮想メソッド (非静的メソッド) を指定します実行時に、呼び出されるメソッドに、目的オブジェクトへのポインタ最初引数 (this ポインタ) として渡されます。メタデータ格納されているシグネチャには、この最初引数の型は含まれていません。メソッド明らかに指定されており、そのメソッド所有するクラスメタデータから確認できるためです。 
.NET Compact Framework によるサポートStandard共通言語ランタイム決定されている既定呼び出し規約指定します。この静的メソッド呼び出し規約使用しますインスタンス仮想メソッドには、HasThis使用します。 
.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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CallingConventions 列挙体」の関連用語

CallingConventions 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CallingConventions 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS