Type.IsNested プロパティとは? わかりやすく解説

Type.IsNested プロパティ

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

現在の Type オブジェクトが、別の型の定義内に入れ子になっている定義で定義された型を表しているかどうかを示す値を取得します

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

解説解説

IsNested プロパティは、すべての入れ子にされた型に対して true返します可視性は関係ありません。入れ子および参照範囲同時にテストするには、関連するプロパティ IsNestedAssembly、IsNestedFamily、IsNestedFamANDAssem、IsNestedFamORAssem、IsNestedPrivate、または IsNestedPublic を使用します

メモメモ

VisibilityMask 列挙メンバは、型の参照範囲属性選択します

使用例使用例

入れ子になったプロテクト クラスおよび入れ子になったパブリック クラス両方に対してIsNested プロパティの値を表示するコード例次に示します

Imports System

Public Class Example
    Protected Class NestedProtected
    End Class

    Public Class NestedPublic
    End Class

    Public Shared Sub Main()
        With GetType(NestedProtected)
            Console.WriteLine("Is " & .FullName
 & " nested? " & .IsNested)
        End With
        With GetType(NestedPublic)
            Console.WriteLine("Is " & .FullName
 & " nested? " & .IsNested)
        End With
    End Sub
End Class

' This example produces the following output:
'
'Is Example+NestedProtected nested? True
'Is Example+NestedPublic nested? True 
using System;

public class Example
{
    protected class NestedProtected
    {
    }

    public class NestedPublic
    {
    }

    public static void Main()
    {
        Type t = typeof(NestedProtected);
        Console.WriteLine("Is {0} nested? {1}", t.FullName, t.IsNested);
        t = typeof(NestedPublic);
        Console.WriteLine("Is {0} nested? {1}", t.FullName, t.IsNested);
    }
}

/* This example produces the following output:

Is Example+NestedProtected nested? True
Is Example+NestedPublic nested? True 
 */
using namespace System;

public ref class Example
{
protected:
   ref class NestedProtected{};

public:
   ref class NestedPublic{};

   static void Main()
   {
      Type^ t = NestedProtected::typeid;
      Console::WriteLine( L"Is {0} nested? {1}",
         t->FullName, t->IsNested );
      t = NestedPublic::typeid;
      Console::WriteLine( L"Is {0} nested? {1}",
         t->FullName, t->IsNested );
   }

};

int main()
{
   Example::Main();
}

/* This example produces the following output:

Is Example+NestedProtected nested? True
Is Example+NestedPublic nested? True
 */
import System.*;

public class Example
{
    protected class NestedProtected
    {
    } //NestedProtected

    public class NestedPublic
    {
    } //NestedPublic

    public static void main(String[]
 args)
    {
        Type t = NestedProtected.class.ToType();
        Console.WriteLine("Is {0} nested? {1}", t.get_FullName(), 
            (System.Boolean)t.get_IsNested());
        t = NestedPublic.class.ToType();
        Console.WriteLine("Is {0} nested? {1}", t.get_FullName(),
            (System.Boolean)t.get_IsNested());
    } //main
} //Example

/* This example produces the following output:

Is Example+NestedProtected nested? True
Is Example+NestedPublic nested? True 
 */
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Type クラス
Type メンバ
System 名前空間
IsNestedAssembly
IsNestedFamily
IsNestedFamANDAssem
IsNestedFamORAssem
IsNestedPrivate
IsNestedPublic


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

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

辞書ショートカット

すべての辞書の索引

Type.IsNested プロパティのお隣キーワード
検索ランキング

   

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



Type.IsNested プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS