Export (0) Print
Expand All

MarshalAsAttribute.SizeParamIndex Field

Indicates the zero-based parameter that contains the count of array elements, similar to size_is in COM.

Namespace:  System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

val mutable SizeParamIndex: int16

The SizeParamIndex field supports managed-to-unmanaged and unmanaged-to-managed calls. It does not have any effect on managed code that calls COM objects.

Depending on the managed type and the attributes applied to it, the array can be passed as a safe array or C-style array.

When arrays are passed as C-style arrays, the marshaler cannot determine the size of the array. Therefore, to pass an managed array to an unmanaged function or method, you must provide two arguments:

  • The array, defined by reference or value.

  • The array size, defined by reference or value.

The zero-based index of the array size parameter is defined by using the SizeParamIndex field.

If you specify both SizeParamIndex and MarshalAsAttribute.SizeConst with a UnmanagedType.LPArray field, the sum of the fields' values produces a size total.

For more information, see Default Marshaling for Arrays.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft