Name

MarshalAsAttribute

Synopsis

This optional attribute is used to explicitly specify the unmanaged type a parameter, field, or return value should be marshaled to. If you do not specify this attribute, .NET uses the type’s default marshaler. The UnmanagedType enumeration contains the unmanaged types you can marshal to with this attribute.

Public NotInheritable Class MarshalAsAttribute : Inherits Attribute
' Public Constructors
   Public Sub New( ByVal unmanagedType As Short) 
   Public Sub New( ByVal unmanagedType As UnmanagedType) 
' Public Instance Fields
   Public ArraySubType As UnmanagedType  
   Public MarshalCookie As String  
   Public MarshalType As String  
   Public MarshalTypeRef As Type  
   Public SafeArraySubType As VarEnum  
   Public SafeArrayUserDefinedSubType As Type  
   Public SizeConst As Integer  
   Public SizeParamIndex As Short  
' Public Instance Properties
   Public ReadOnly Property Value As UnmanagedType  
End Class

Hierarchy

System.ObjectSystem.Attribute MarshalAsAttribute

Valid On

Field, Parameter, ReturnValue

Get VB.NET Core Classes in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.