指定したオブジェクトに指定した型のハンドルを割り当てます。
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;
パラメータ
- value
GCHandle を使用するオブジェクト。 - type
作成する GCHandle の型を示す、 GCHandleType 値の 1 つ。
戻り値
指定した型の新しい GCHandle 。 GCHandle は、不要になったときに 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 セキュリティ:
- SecurityPermission (アンマネージ コードを操作するために必要なアクセス許可) SecurityPermissionFlag.UnmanagedCode (関連する列挙体)
参照
GCHandle 構造体 | GCHandle メンバ | System.Runtime.InteropServices 名前空間 | GCHandle.Alloc オーバーロードの一覧 | GCHandleType