Type.IsAutoLayout 속성

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

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

구문

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

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

속성 값

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

설명

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

클래스의 개체에 대한 최상의 레이아웃 방법을 런타임 엔진에서 결정하도록 하려면 AutoLayout 특성을 사용합니다. AutoLayout 특성으로 표시된 클래스는 로더에서 적절한 방법을 선택하여 클래스를 레이아웃할 것이며 지정된 레이아웃 정보는 무시됨을 나타냅니다.

현재 Type이 생성된 제네릭 형식을 나타내는 경우 이 속성은 형식이 생성된 제네릭 형식 정의에 적용됩니다. 예를 들어, 현재 TypeMyGenericType<int>(Visual Basic의 경우 MyGenericType(Of Integer))을 나타내는 경우 이 속성의 값은 MyGenericType<T>.에 의해 결정됩니다.

현재 Type이 제네릭 형식 또는 제네릭 메서드 정의의 형식 매개 변수를 나타내는 경우 이 속성은 항상 false를 반환합니다.

예제

다음 예제에서는 형식의 인스턴스를 만들고 IsAutoLayout 속성을 표시합니다.

Imports System
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic

' The Demo class is has the AutoLayout attribute.
<StructLayoutAttribute(LayoutKind.Auto)> _
Public Class Demo
End Class 

Public Class Example
    Public Shared Sub Main()
        ' Get the Type object for the Demo class.
        Dim myType As Type = GetType(Demo)
        ' Get and display the IsAutoLayout property of the 
        ' Demo class.
        Console.WriteLine("The AutoLayout property for the Demo class is '{0}'.", _
            myType.IsAutoLayout.ToString())
    End Sub 
End Class 
using System;
using System.Runtime.InteropServices;

// The Demo class is attributed as AutoLayout.
[StructLayoutAttribute(LayoutKind.Auto)]
public class Demo
{
}

public class Example
{
    public static void Main()
    {
        // Create an instance of the Type class using the GetType method.
        Type  myType=typeof(Demo);
        // Get and display the IsAutoLayout property of the 
        // Demoinstance.
        Console.WriteLine("\nThe AutoLayout property for the Demo class is {0}.",
            myType.IsAutoLayout); 
    }
}
#using <System.dll>

using namespace System;
using namespace System::Reflection;
using namespace System::ComponentModel;
using namespace System::Runtime::InteropServices;

// The MyDemoAttribute class is selected as AutoLayout.

[StructLayoutAttribute(LayoutKind::Auto)]
public ref class MyDemoAttribute{};

void MyAutoLayoutMethod( String^ typeName )
{
   try
   {
      
      // Create an instance of the Type class using the GetType method.
      Type^ myType = Type::GetType( typeName );
      
      // Get and display the IsAutoLayout property of the
      // MyDemoAttribute instance.
      Console::WriteLine( "\nThe AutoLayout property for the MyDemoAttribute is {0}.", myType->IsAutoLayout );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "\nAn exception occurred: {0}.", e->Message );
   }

}

int main()
{
   MyAutoLayoutMethod( "MyDemoAttribute" );
}
import System.*;
import System.Reflection.*;
import System.ComponentModel.*;
import System.Runtime.InteropServices.*;

// The MyDemoAttribute class is selected as AutoLayout.
/** @attribute StructLayoutAttribute(LayoutKind.Auto)
 */
public class MyDemoAttribute
{
} //MyDemoAttribute

public class MyTypeClass
{
    public static void main(String[] args)
    {
        MyAutoLayoutMethod("MyDemoAttribute");
    } //main

    public static void MyAutoLayoutMethod(String typeName)
    {
        try {
            // Create an instance of the Type class using the GetType method.
            Type myType = Type.GetType(typeName);
            // Get and display the IsAutoLayout property of the 
            // MyDemoAttribute instance.
            Console.WriteLine("\nThe AutoLayout property for the" 
                + " MyDemoAttribute is {0}.", System.Convert.ToString(myType.
                get_IsAutoLayout()));
        }
        catch (System.Exception e) {
            Console.WriteLine("\nAn exception occurred: {0}.", e.get_Message());
        }
    } //MyAutoLayoutMethod
} //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에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

Type 클래스
Type 멤버
System 네임스페이스
TypeAttributes
IsLayoutSequential
IsExplicitLayout

기타 리소스

메타데이터 개요