Type.IsExplicitLayout Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets a value indicating whether the class layout attribute ExplicitLayout is selected for the Type.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
Public ReadOnly Property IsExplicitLayout As Boolean
public bool IsExplicitLayout { get; }
Property Value
Type: System..::.Boolean
true if the class layout attribute ExplicitLayout is selected for the Type; otherwise, false.
Remarks
The LayoutMask is used to select the class layout attributes. The class layout attributes (AutoLayout, SequentialLayout and ExplicitLayout) define how the fields of the class instance are laid out in memory.
Classes marked with the ExplicitLayout attribute cause the loader to ignore field sequence and to use the explicit layout rules provided, in the form of field offsets, overall class size and alignment, or all of these.
Use the ExplicitLayout attribute to specify the offsets at which each field starts, or to specify the overall size and, optionally, the packing size of the objects of the class. The packing size is the empty memory space between fields and must be 1, 2, 4, 8 or 16 bytes.
If the current Type represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current Type represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.
If the current Type represents a type parameter in the definition of a generic type or generic method, this property always returns false.
Examples
The following example creates an instance of a type and displays the value of its IsExplicitLayout property. It uses the MySystemTime class, which is also in the code example for StructLayoutAttribute.
Version Information
Windows Phone OS
Supported in: 8.1, 8.0