次の方法で共有


GCHandle.Alloc メソッド (Object, GCHandleType)

指定したオブジェクトに指定した型のハンドルを割り当てます。

Overloads Public Shared Function Alloc( _
   ByVal value As Object, _   ByVal type As GCHandleType _) As GCHandle
[C#]
public static GCHandle Alloc(objectvalue,GCHandleTypetype);
[C++]
public: static GCHandle Alloc(Object* value,GCHandleTypetype);
[JScript]
public static function Alloc(
   value : Object,type : GCHandleType) : GCHandle;

パラメータ

戻り値

指定した型の新しい GCHandleGCHandle は、不要になったときに Free で解放する必要があります。

例外

例外の種類 条件
ArgumentException 非プリミティブ (非 blittable) メンバを持つインスタンスは固定できません。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

.NET Framework セキュリティ:

参照

GCHandle 構造体 | GCHandle メンバ | System.Runtime.InteropServices 名前空間 | GCHandle.Alloc オーバーロードの一覧 | GCHandleType