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

Dim t As Type Dim returnValue As IntPtr returnValue = Marshal.GetITypeInfoForType(t)
戻り値
t パラメータの ITypeInfo ポインタ。


このメソッドは、元の型をベースにした ITypeInfo の実装へのポインタを返します。GetITypeInfoForType でオブジェクトを呼び出すと、ポインタが返される前に、インターフェイス ポインタで参照カウントがインクリメントされます。ポインタの使用が終わったときは、必ず Marshal.Release を使用して参照カウントをデクリメントしてください。System.Runtime.InteropServices.MarshalAsAttribute を適用すると、相互運用マーシャリングの標準の動作をこのカスタム マーシャラの動作で置き換えることができます。ITypeInfo の詳細については、MSDN ライブラリを参照してください。
![]() |
---|
このメソッドは SecurityAction.LinkDemand を使用して、信頼関係のないコードからの呼び出しを防ぎます。SecurityPermissionAttribute.UnmanagedCode アクセス許可は、直前の呼び出し元にのみ要求されます。信頼性が一部しか確認されていないコードから呼び出すことができるコードの場合、ユーザー入力を検証せずに Marshal クラスに渡すことは避けてください。LinkDemand メンバの使用に関する重要な制約事項については、「Demand と LinkDemand」を参照してください。 |

GetITypeInfoForType メソッドを使用して、型の ITypeInfo インターフェイスへのポインタを取得する方法を次のコード例に示します。
Imports System.Runtime.InteropServices Module Program Sub Run() ' Dim a pointer Dim pointer As IntPtr Console.WriteLine("Calling Marshal.GetIUnknownForObjectInContext...") ' Get the ITypeInfo pointer for an Object type pointer = Marshal.GetITypeInfoForType(Type.GetType("System.Object")) Console.WriteLine("Calling Marshal.Release...") ' Always call Marshal.Release to decrement the reference count. Marshal.Release(pointer) End Sub Sub Main(ByVal args() As String) Run() End Sub End Module
using System; using System.Runtime.InteropServices; class Program { static void Run() { Console.WriteLine("Calling Marshal.GetITypeInfoForType..."); // Get the ITypeInfo pointer for an Object type IntPtr pointer = Marshal.GetITypeInfoForType(typeof(object)); Console.WriteLine("Calling Marshal.Release..."); // Always call Marshal.Release to decrement the reference count. Marshal.Release(pointer); } static void Main(string[] args) { Run(); } }

- SecurityPermission (アンマネージ コードを呼び出すために必要なアクセス許可)。 UnmanagedCode (関連する列挙体)。LinkDemand (セキュリティ アクション)。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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

- Marshal.GetITypeInfoForType メソッドのページへのリンク