RuntimeHelpers.GetObjectValue メソッド
アセンブリ: mscorlib (mscorlib.dll 内)

Dim obj As Object Dim returnValue As Object returnValue = RuntimeHelpers.GetObjectValue(obj)
戻り値
値クラスの場合は obj のボックスに格納されたコピーを返します。それ以外の場合は obj を返します。


GetObjectValue メソッドを使用して値クラスをボックス化する方法を次のコード例に示します。
Imports System.Runtime.CompilerServices ' Declare a value type. Structure Point2I Dim x As Integer Dim y As Integer End Structure Module Program Sub Main(ByVal args() As String) ' Allocate an unboxed Point2I (not on the heap). Dim pnt As Point2I pnt.x = 0 pnt.y = 0 ' Box the value. (Put it in the heap.) Dim objPntr As Object = RuntimeHelpers.GetObjectValue(pnt) End Sub End Module
using System; using System.Runtime.CompilerServices; // Declare a value type. struct Point2I { public int x; public int y; } class Program { static void Main(string[] args) { // Allocate an unboxed Point2I (not on the heap). Point2I pnt; pnt.x = 0; pnt.y = 0; // Box the value. (Put it in the heap.) object objPntr = RuntimeHelpers.GetObjectValue(pnt); } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からRuntimeHelpers.GetObjectValue メソッドを検索する場合は、下記のリンクをクリックしてください。

- RuntimeHelpers.GetObjectValue メソッドのページへのリンク