MarshalAsAttribute.MarshalTypeRef フィールド

定義

MarshalTypeを型として実装します。

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 

フィールド値

属性

注釈

MarshalTypeRefまたはMarshalTypeフィールドを使用して、属性付きパラメーター、フィールド、または戻り値の型にカスタム マーシャラー型を指定できます。 MarshalTypeRef フィールドを使用すると、構文を短くすることでMarshalTypeを簡単に使用できます。 次の例では、1 行目は MarshalType を使用した構文を表し、2 行目は MarshalTypeRef を使用した構文を表しています。

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

C# では typeof、Visual Basic では GetType、C++ では typeid を使用して、Type オブジェクトを設定できます。

適用対象

こちらもご覧ください