_Type.IsExplicitLayoutとは? わかりやすく解説

Type.IsExplicitLayout プロパティ

Type に、クラスレイアウト属性として ExplicitLayout選択されているかどうかを示す値を取得します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

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 ()

プロパティ
Type に、クラスレイアウト属性として ExplicitLayout選択されている場合trueそれ以外場合false

解説解説

LayoutMask は、クラスレイアウト属性選択するために使用しますクラス レイアウト属性 (AutoLayoutSequentialLayout、および ExplicitLayout) は、クラス インスタンスフィールドメモリ上でレイアウト定義します

ExplicitLayout 属性クラスマークすると、ローダーフィールド順序無視しフィールド オフセットクラス全体サイズ配置、またはそれらすべて、などの形で指定されている明示的なレイアウト規則使用します

フィールド開始位置オフセットクラスオブジェクト全体サイズ、またはオプションとして、クラスオブジェクトパッキング サイズ指定するには、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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

_Type.IsExplicitLayout プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

COM オブジェクトに、Type.IsExplicitLayout プロパティへのバージョン依存しないアクセス用意されています。

このプロパティは、CLS準拠していません。  

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As _Type
Dim value As Boolean

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

プロパティ
Type に、クラスレイアウト属性として ExplicitLayout選択されている場合trueそれ以外場合false

解説解説

このプロパティは、アンマネージ コードからマネージ クラスアクセスするためのプロパティであるため、マネージ コードからは呼び出さないください

Type.IsExplicitLayout プロパティは、Type に、クラスレイアウト属性として ExplicitLayout選択されているかどうかを示す値を取得します

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」から_Type.IsExplicitLayoutを検索した結果を表示しています。
Weblioに収録されているすべての辞書から_Type.IsExplicitLayoutを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書から_Type.IsExplicitLayoutを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「_Type.IsExplicitLayout」の関連用語

_Type.IsExplicitLayoutのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



_Type.IsExplicitLayoutのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS