GCHandle.Alloc-Methode: (Object, GCHandleType)
Veröffentlicht: Oktober 2016
Reserviert ein Handle vom angegebenen Typ für das angegebene Objekt.
Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Syntax
[SecurityCriticalAttribute]
public static GCHandle Alloc(
object value,
GCHandleType type
)
public:
[SecurityCriticalAttribute]
static GCHandle Alloc(
Object^ value,
GCHandleType type
)
[<SecurityCriticalAttribute>]
static member Alloc :
value:Object *
type:GCHandleType -> GCHandle
<SecurityCriticalAttribute>
Public Shared Function Alloc (
value As Object,
type As GCHandleType
) As GCHandle
Parameter
value
Type: System.ObjectDas Objekt, das GCHandle.
type
Type: System.Runtime.InteropServices.GCHandleTypeEines der GCHandleType Werte, die den Typ des GCHandle zu erstellen.
Rückgabewert
Type: System.Runtime.InteropServices.GCHandle
Ein neues GCHandle des angegebenen Typs. Diese GCHandle müssen freigegeben werden, mit Free Wenn es nicht mehr benötigt wird.
Ausnahmen
Exception | Condition |
---|---|
ArgumentException | Eine Instanz mit nicht primitiven (nicht blitfähigen) Membern kann nicht fixiert werden. |
Sicherheit
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.
Versionsinformationen
Universelle Windows-Plattform
Verfügbar seit 8
.NET Framework
Verfügbar seit 1.1
Portierbare Klassenbibliothek
Unterstützt in: portierbare .NET-Plattformen
Silverlight
Verfügbar seit 2.0
Windows Phone Silverlight
Verfügbar seit 7.0
Windows Phone
Verfügbar seit 8.1
Siehe auch
GCHandleType
Alloc Überladen
GCHandle-Struktur
System.Runtime.InteropServices-Namespace
Zurück zum Anfang