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 

フィールド値

属性

注釈

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

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

オブジェクトは、TypeC#、Visual Basic、GetTypeまたは typeid C++ で を使用してtypeof設定できます。 カスタム マーシャラーの作成と使用の詳細については、「 カスタム マーシャリング」を参照してください。

適用対象

こちらもご覧ください