Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Class

StructLayoutAttribute

class StructLayoutAttribute

Module: System.Runtime.InteropServices
Assembly: System.Runtime.dll
Source file: StructLayoutAttribute.rvn

Inheritance: Object → Attribute → StructLayoutAttribute

Describes native struct storage; does not convert or pin managed storage. The current native-library backend supports Sequential and Explicit layouts on macOS ARM64. Passing structs by value is not supported.

Constructors

1 item
StructLayoutAttribute(layoutKind: LayoutKind) Records field placement. Explicit requires FieldOffset on each instance field.

Properties

3 items
Pack: int Gets or sets native packing. Zero selects the platform default (eight). Supported explicit values are powers of two from one through 128.
Size: int Gets or sets the minimum byte size; zero lets fields determine the size. The native layout includes tail padding to its alignment.
Value: LayoutKind Gets the requested field placement.

Methods

4 items
Equals(other: object?) -> bool Tests reference identity by default; an ordinary class may override equality. Inherited from Object.Equals
GetHashCode() -> int Returns a stable identity hash by default; an ordinary class may override it consistently with equality. Inherited from Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
ToString() -> string Returns the concrete runtime type name for supported references, or display text from a class or boxed-struct override. Inherited from Object.ToString