Mono Class Library: System.Runtime.InteropServices Namespace

System.Runtime.InteropServices.MarshalAsAttribute Class

Specifies how data is to be marshaled between managed and unmanaged code.

See Also: MarshalAsAttribute Members

System.Object
     System.Attribute
          System.Runtime.InteropServices.MarshalAsAttribute

[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.ReturnValue | System.AttributeTargets.All, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class MarshalAsAttribute : Attribute

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.

Remarks

This attribute can be applied to parameters, fields, or return values.

Each data type has a default marshaling behavior that is used if this attribute is not present. This attribute is only required when a type can be marshaled as more than one possible types.

Note: The System.Runtime.InteropServices.UnmanagedType enumeration specifies possible data types.

Compilers are required to not preserve this type in metadata as a custom attribute. Instead, compilers are required to emit it directly in the file format, as described in Partition II of the CLI Specification. Metadata consumers, such as the Reflection API, are required to retrieve this data from the file format and return it as if it were a custom attribute.

Requirements

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0