MarshalAsAttribute::MarshalTypeRef Field
Implements MarshalAsAttribute::MarshalType as a type.
Assembly: mscorlib (in mscorlib.dll)
Field Value
Type: System::Type^You can use either the MarshalTypeRef or MarshalType field to specify a custom marshaler type for the attributed parameter, field, or return type. The MarshalTypeRef field allows easier usage of MarshalType by shortening the syntax. In the following example, the first line represents syntax using MarshalType and the second line represents syntax using MarshalTypeRef.
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Assembly, NameSpace.TypeName")]
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(NameSpace.TypeName)]
You can set a Type object using typeof in C#, GetType in Visual Basic, or typeid in C++. For additional information about creating and using custom marshalers, see Custom Marshaling.
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1