RuntimeTypeHandleとは? わかりやすく解説

RuntimeTypeHandle プロパティ


RuntimeTypeHandle メソッド


RuntimeTypeHandle メンバ

内部メタデータ トークン使用する型表します

RuntimeTypeHandle データ型公開されるメンバを以下の表に示します


パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Value このインスタンスによって表される型へのハンドル取得します
パブリック メソッドパブリック メソッド
参照参照

関連項目

RuntimeTypeHandle 構造体
System 名前空間

RuntimeTypeHandle 構造体

内部メタデータ トークン使用する型表します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Structure RuntimeTypeHandle
    Implements ISerializable
Dim instance As RuntimeTypeHandle
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public struct RuntimeTypeHandle : ISerializable
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public value class RuntimeTypeHandle : ISerializable
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class RuntimeTypeHandle extends
 ValueType implements ISerializable
JScript では、構造体使用できますが、新規に宣言することはできません。
使用例使用例

RuntimeTypeHandle取得する方法次の例に示します

Imports System
Imports System.Reflection

 _
Public Class MyClass1
   Private x As Integer
 = 0
   
   Public Function MyMethod() As
 Integer
      Return x
   End Function 'MyMethod
End Class 'MyClass1
 _
Public Class MyClass2
   
   Public Shared Sub Main()
      Dim myClass1 As New
 MyClass1()
      
      ' Get the RuntimeTypeHandle from an object.
      Dim myRTHFromObject As RuntimeTypeHandle
 = Type.GetTypeHandle(myClass1)
      ' Get the RuntimeTypeHandle from a type.
      Dim myRTHFromType As RuntimeTypeHandle
 = GetType(MyClass1).TypeHandle
      
      Console.WriteLine("myRTHFromObject.Value: {0}",
 myRTHFromObject.Value)
      Console.WriteLine("myRTHFromObject.Type: {0}",
 myRTHFromObject.GetType())
      Console.WriteLine("myRTHFromType.Value: {0}",
 myRTHFromType.Value)
      Console.WriteLine("myRTHFromType.Type: {0}",
 myRTHFromType.GetType())
   End Sub 'Main 
End Class 'MyClass2
using System;
using System.Reflection;
public class MyClass1
{
    private int x=0;
    public int MyMethod()
    {
        return x;
    }
}
public class MyClass2
{
    public static void Main()
    {
        MyClass1 myClass1 = new MyClass1();

        // Get the RuntimeTypeHandle from an object.
        RuntimeTypeHandle myRTHFromObject = Type.GetTypeHandle(myClass1);
        // Get the RuntimeTypeHandle from a type.
        RuntimeTypeHandle myRTHFromType = typeof(MyClass1).TypeHandle;

        Console.WriteLine("myRTHFromObject.Value: {0}", myRTHFromObject.Value);
        Console.WriteLine("myRTHFromObject.Type: {0}", myRTHFromObject.GetType());
        Console.WriteLine("myRTHFromType.Value: {0}", myRTHFromType.Value);
        Console.WriteLine("myRTHFromType.Type: {0}", myRTHFromType.GetType());

    }
}
using namespace System;
using namespace System::Reflection;
public ref class MyClass1
{
private:
   int x;

public:
   int MyMethod()
   {
      return x;
   }
};

int main()
{
   MyClass1^ myClass1 = gcnew MyClass1;
   
   // Get the RuntimeTypeHandle from an object.
   RuntimeTypeHandle myRTHFromObject = Type::GetTypeHandle( myClass1 );
   
   // Get the RuntimeTypeHandle from a type.
   RuntimeTypeHandle myRTHFromType = MyClass1::typeid->TypeHandle;
   Console::WriteLine( "myRTHFromObject.Value: {0}", myRTHFromObject.Value
 );
   Console::WriteLine( "myRTHFromObject.Type: {0}", myRTHFromObject.GetType()
 );
   Console::WriteLine( "myRTHFromType.Value: {0}", myRTHFromType.Value
 );
   Console::WriteLine( "myRTHFromType.Type: {0}", myRTHFromType.GetType()
 );
}
import System.*;
import System.Reflection.*;

public class MyClass1
{
    private int x = 0;

    public int MyMethod()
    {
        return x;
    } //MyMethod
} //MyClass1

public class MyClass2
{
    public static void main(String[]
 args)
    {
        MyClass1 myClass1 = new MyClass1();
        // Get the RuntimeTypeHandle from an object.
        RuntimeTypeHandle myRTHFromObject = Type.GetTypeHandle(myClass1);
        // Get the RuntimeTypeHandle from a type.
        RuntimeTypeHandle myRTHFromType = (MyClass1.class.ToType()).
            get_TypeHandle();

        Console.WriteLine("myRTHFromObject.Value: {0}", myRTHFromObject.
            get_Value());
        Console.WriteLine("myRTHFromObject.Type: {0}", myRTHFromObject.
            GetType());
        Console.WriteLine("myRTHFromType.Value: {0}", myRTHFromType.
            get_Value());
        Console.WriteLine("myRTHFromType.Type: {0}", myRTHFromType.
            GetType());
    }//main 
} //MyClass2
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「RuntimeTypeHandle」の関連用語

RuntimeTypeHandleのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS