Type.IsLayoutSequential 속성

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

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

구문

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

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

속성 값

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

설명

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

자세한 내용은 CLI(공용 언어 인프라) 설명서의 "Partition II: Metadata Definition and Semantics"에서 사양에 대해 설명한 9.1.2 단원을 참조하십시오. 이 설명서는 https://msdn.microsoft.com/net/ecma/http://www.ecma-international.org/publications/standards/Ecma-335.htm에서 온라인으로 볼 수 있습니다.

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

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

예제

다음 예제에서는 StructLayoutAttribute 클래스에 있는 LayoutKind 열거형의 Sequential 멤버가 설정된 클래스의 인스턴스를 만들고 IsLayoutSequential 속성을 확인하여 결과를 표시합니다.

Imports System
Imports System.Reflection
Imports System.ComponentModel
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic
Class MyTypeSequential1
End Class 'MyTypeSequential1
<StructLayoutAttribute(LayoutKind.Sequential)> Class MyTypeSequential2
    Public Shared Sub Main()
        Try
            ' Create an instance of MyTypeSequential1.
            Dim myObj1 As New MyTypeSequential1()
            Dim myTypeObj1 As Type = myObj1.GetType()
            ' Check for and display the SequentialLayout attribute.
            Console.WriteLine(ControlChars.Cr + "The object myObj1 has IsLayoutSequential: {0}.", myObj1.GetType().IsLayoutSequential.ToString())
            ' Create an instance of MyTypeSequential2.
            Dim myObj2 As New MyTypeSequential2()
            Dim myTypeObj2 As Type = myObj2.GetType()
            ' Check for and display the SequentialLayout attribute.
            Console.WriteLine(ControlChars.Cr + "The object myObj2 has IsLayoutSequential: {0}.", myObj2.GetType().IsLayoutSequential.ToString())
        Catch e As Exception
            Console.WriteLine(ControlChars.Cr + "An exception occurred: {0}", e.Message.ToString())
        End Try
    End Sub 'Main
End Class 'MyTypeSeq2
using System;
using System.Reflection;
using System.ComponentModel;
using System.Runtime.InteropServices;
class MyTypeSequential1
{
}
[StructLayoutAttribute(LayoutKind.Sequential)]
class MyTypeSequential2
{
    public static void Main(string []args)
    {
        try
        {
            // Create an instance of myTypeSeq1.
            MyTypeSequential1 myObj1 = new MyTypeSequential1();
            Type myTypeObj1 = myObj1.GetType();
            // Check for and display the SequentialLayout attribute.
            Console.WriteLine("\nThe object myObj1 has IsLayoutSequential: {0}.", myObj1.GetType().IsLayoutSequential);
            // Create an instance of 'myTypeSeq2' class.
            MyTypeSequential2 myObj2 = new MyTypeSequential2();
            Type myTypeObj2 = myObj2.GetType();
            // Check for and display the SequentialLayout attribute.
            Console.WriteLine("\nThe object myObj2 has IsLayoutSequential: {0}.", myObj2.GetType().IsLayoutSequential);
        }
        catch(Exception e)
        {
            Console.WriteLine("\nAn exception occurred: {0}", e.Message);
        }
    }
}
#using <System.dll>

using namespace System;
using namespace System::Reflection;
using namespace System::ComponentModel;
using namespace System::Runtime::InteropServices;
ref class MyTypeSequential1{};


[StructLayoutAttribute(LayoutKind::Sequential)]
ref class MyTypeSequential2{};

int main()
{
   try
   {
      
      // Create an instance of myTypeSeq1.
      MyTypeSequential1^ myObj1 = gcnew MyTypeSequential1;
      
      // Check for and display the SequentialLayout attribute.
      Console::WriteLine( "\nThe object myObj1 has IsLayoutSequential: {0}.", myObj1->GetType()->IsLayoutSequential );
      
      // Create an instance of 'myTypeSeq2' class.
      MyTypeSequential2^ myObj2 = gcnew MyTypeSequential2;
      
      // Check for and display the SequentialLayout attribute.
      Console::WriteLine( "\nThe object myObj2 has IsLayoutSequential: {0}.", myObj2->GetType()->IsLayoutSequential );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "\nAn exception occurred: {0}", e->Message );
   }

}
import System.*;
import System.Reflection.*;
import System.ComponentModel.*;
import System.Runtime.InteropServices.*;
class MyTypeSequential1
{
} //MyTypeSequential1

/** @attribute StructLayoutAttribute(LayoutKind.Sequential)
 */
class MyTypeSequential2
{
    public static void main(String[] args)
    {
        try {
            // Create an instance of myTypeSeq1.
            MyTypeSequential1 myObj1 = new MyTypeSequential1();
            Type myTypeObj1 = myObj1.GetType();
            // Check for and display the SequentialLayout attribute.
            Console.WriteLine("\nThe object myObj1 has IsLayoutSequential: {0}.",
                System.Convert.ToString(myObj1.GetType().
                get_IsLayoutSequential()));
            // Create an instance of 'myTypeSeq2' class.
            MyTypeSequential2 myObj2 = new MyTypeSequential2();
            Type myTypeObj2 = myObj2.GetType();
            // Check for and display the SequentialLayout attribute.
            Console.WriteLine("\nThe object myObj2 has IsLayoutSequential: {0}.",
                System.Convert.ToString(myObj2.GetType().
                get_IsLayoutSequential()));
        }
        catch (System.Exception e) {
            Console.WriteLine("\nAn exception occurred: {0}", e.get_Message());
        }
    } //main
} //MyTypeSequential2

플랫폼

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 속성
Type.IsExplicitLayout 속성

기타 리소스

메타데이터 개요