MarshalAsAttribute.MarshalTypeRef Pole

Definicja

Implementuje MarshalType jako typ.

public: Type ^ MarshalTypeRef;
public Type MarshalTypeRef;
public Type? MarshalTypeRef;
[System.Runtime.InteropServices.ComVisible(true)]
public Type MarshalTypeRef;
val mutable MarshalTypeRef : Type
[<System.Runtime.InteropServices.ComVisible(true)>]
val mutable MarshalTypeRef : Type
Public MarshalTypeRef As Type 

Wartość pola

Atrybuty

Uwagi

Możesz użyć MarshalTypeRef pola lub MarshalType , aby określić niestandardowy typ marshalera dla parametru atrybutu, pola lub typu zwracanego. Pole MarshalTypeRef umożliwia łatwiejsze użycie MarshalType , skracając składnię. W poniższym przykładzie pierwszy wiersz reprezentuje składnię przy użyciu metody MarshalType , a drugi wiersz reprezentuje składnię przy użyciu metody MarshalTypeRef.

[MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Assembly, NameSpace.TypeName")]
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(NameSpace.TypeName))]

Można ustawić obiekt Type przy użyciu typeof w języku C#, GetType w Visual Basic lub typeid w języku C++.

Dotyczy

Zobacz też