Type.IsExplicitLayout 속성

Type에 대해 클래스 레이아웃 특성 ExplicitLayout이 선택되었는지 여부를 나타내는 값을 가져옵니다.

네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public ReadOnly Property IsExplicitLayout As Boolean
‘사용 방법
Dim instance As Type
Dim value As Boolean

value = instance.IsExplicitLayout
public bool IsExplicitLayout { get; }
public:
virtual property bool IsExplicitLayout {
    bool get () sealed;
}
/** @property */
public final boolean get_IsExplicitLayout ()
public final function get IsExplicitLayout () : boolean

속성 값

Type에 대해 클래스 레이아웃 특성 ExplicitLayout이 선택되면 true이고, 그렇지 않으면 false입니다.

설명

LayoutMask는 클래스 레이아웃 특성을 선택하는 데 사용됩니다. 클래스 레이아웃 특성(AutoLayout, SequentialLayoutExplicitLayout)은 클래스 인스턴스의 필드가 메모리에 레이아웃되는 방법을 정의합니다.

클래스를 ExplicitLayout 특성으로 표시하면 로더에서는 필드 순서를 무시하고 필드 오프셋, 전체 클래스 크기, 맞춤 등의 형식에 따라 제공된 explicit 레이아웃 규칙을 사용하게 됩니다.

각 필드의 시작 지점에 오프셋을 지정하거나, 클래스의 개체에 대한 전체 크기 및 압축 크기(선택적 요소)를 지정하려면 ExplicitLayout 특성을 사용합니다. 압축 크기는 각 필드 사이의 빈 메모리 공간으로서 1, 2, 4, 8 또는 16바이트여야 합니다.

현재 Type이 생성된 제네릭 형식을 나타내는 경우 이 속성은 형식이 생성된 제네릭 형식 정의에 적용됩니다. 예를 들어, 현재 TypeMyGenericType<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에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

Type 클래스
Type 멤버
System 네임스페이스
TypeAttributes
Type.IsAutoLayout 속성
IsLayoutSequential

기타 리소스

메타데이터 개요