Type.IsExplicitLayout プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


LayoutMask は、クラスのレイアウト属性を選択するために使用します。クラス レイアウト属性 (AutoLayout、SequentialLayout、および ExplicitLayout) は、クラス インスタンスのフィールドのメモリ上でのレイアウトを定義します。
ExplicitLayout 属性でクラスをマークすると、ローダーはフィールドの順序を無視し、フィールド オフセット、クラス全体のサイズと配置、またはそれらすべて、などの形で指定されている明示的なレイアウト規則を使用します。
各フィールドの開始位置のオフセット、クラスのオブジェクト全体のサイズ、またはオプションとして、クラスのオブジェクトのパッキング サイズを指定するには、ExplicitLayout 属性を使用します。パッキング サイズはフィールド間の空きメモリ空間であり、1、2、4、8、または 16 バイトである必要があります。
現在の Type が構築ジェネリック型を表している場合、このプロパティは型が構築される元になったジェネリック型定義に適用されます。たとえば、現在の Type が MyGenericType<int> (Visual Basic では MyGenericType(Of Integer)) を表す場合、このプロパティの値は MyGenericType<T> によって決まります。
現在の Type がジェネリック型またはジェネリック メソッドの定義の型パラメータを表している場合、このプロパティは常に false を返します。

指定した型のインスタンスを作成し、 MyDemoAttribute クラスの IsExplicitLayout プロパティを表示する例を次に示します。
Imports System Imports System.Reflection Imports System.ComponentModel Imports System.Runtime.InteropServices Imports Microsoft.VisualBasic 'The class to be tested for the ExplicitLayout property. <StructLayoutAttribute(LayoutKind.Explicit)> _ Public Class Demo End Class Public Class MyTypeClass Public Shared Sub Main() 'Create an instance of the type using the GetType method. Dim myType As Type = GetType(Demo) ' Get and display the IsExplicitLayout property. Console.WriteLine(vbCrLf & "The IsExplicitLayout property of the Demo type is {0}.", _ myType.IsExplicitLayout) End Sub End Class
using System; using System.Reflection; using System.ComponentModel; using System.Runtime.InteropServices; //The class to be tested for the ExplicitLayout property. [StructLayoutAttribute(LayoutKind.Explicit)] public class Demo { } public class MyTypeClass { public static void Main(string[] args) { // Create an instance of the type using the GetType method. Type myType = typeof(Demo); // Get and display the IsExplicitLayout property. Console.WriteLine("\nThe IsExplicitLayout property of the Demo type is {0}.", myType.IsExplicitLayout); } }
#using <System.dll> using namespace System; using namespace System::Reflection; using namespace System::ComponentModel; using namespace System::Runtime::InteropServices; //The class to be tested for the ExplicitLayout property. [StructLayoutAttribute(LayoutKind::Explicit)] public ref class MyDemoAttribute{}; void MyIsExplicitLayoutMethod( String^ typeName ) { try { // Create an instance of the type using the GetType method. Type^ myType = Type::GetType( typeName ); // Get and display the IsExplicitLayout property. Console::WriteLine( "\nThe IsExplicitLayout property of the MyDemoAttribute instance is {0}.", myType->IsExplicitLayout ); } catch ( Exception^ e ) { Console::WriteLine( "\nAn exception occurred: {0}.", e->Message ); } } int main() { MyIsExplicitLayoutMethod( "MyDemoAttribute" ); }
import System.*; import System.Reflection.*; import System.ComponentModel.*; import System.Runtime.InteropServices.*; //The class to be tested for the ExplicitLayout property. /** @attribute StructLayoutAttribute(LayoutKind.Explicit) */ public class MyDemoAttribute { } //MyDemoAttribute public class MyTypeClass { public static void main(String[] args) { MyIsExplicitLayoutMethod("MyDemoAttribute"); } //main public static void MyIsExplicitLayoutMethod(String typeName) { try { // Create an instance of the type using the GetType method. Type myType = Type.GetType(typeName); // Get and display the IsExplicitLayout property. Console.WriteLine("\nThe IsExplicitLayout property of the " + "MyDemoAttribute instance is {0}.", System.Convert. ToString(myType.get_IsExplicitLayout())); } catch (System.Exception e) { Console.WriteLine("\nAn exception occurred: {0}.", e.get_Message()); } } //MyIsExplicitLayoutMethod } //MyTypeClass

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


_Type.IsExplicitLayout プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)

Type に、クラスのレイアウト属性として ExplicitLayout が選択されている場合は true。それ以外の場合は false。

このプロパティは、アンマネージ コードからマネージ クラスにアクセスするためのプロパティであるため、マネージ コードからは呼び出さないでください。
Type.IsExplicitLayout プロパティは、Type に、クラスのレイアウト属性として ExplicitLayout が選択されているかどうかを示す値を取得します。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からType.IsExplicitLayoutを検索する場合は、下記のリンクをクリックしてください。

- Type.IsExplicitLayoutのページへのリンク