MarshalAsAttribute.MarshalTypeRef 字段    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将 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 。 在下面的示例中,第一行表示使用 MarshalType 的语法,第二行表示使用 的 MarshalTypeRef语法。
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Assembly, NameSpace.TypeName")]   
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(NameSpace.TypeName))]  
可以使用 在 C# 中、GetType在 Visual Basic 中或在 typeid C++ 中设置 Type 对象typeof。 有关创建和使用自定义封送处理程序的其他信息,请参阅 自定义封送处理。