Freigeben über


Type.IsNestedPublic-Eigenschaft

Ruft einen Wert ab, der angibt, ob eine Klasse geschachtelt und als öffentlich deklariert ist.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public ReadOnly Property IsNestedPublic As Boolean
'Usage
Dim instance As Type
Dim value As Boolean

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

Eigenschaftenwert

true, wenn die Klasse geschachtelt und als öffentlich deklariert ist, andernfalls false.

Hinweise

Wenn der aktuelle Type einen Typparameter eines generischen Typs darstellt, gibt diese Eigenschaft immer false zurück.

Die Sichtbarkeitsattribute werden mit TypeAttributes.VisibilityMask ausgewählt.

Beispiel

Im folgenden Beispiel wird eine öffentliche, geschachtelte Klasse deklariert, und ihr IsNestedPublic-Eigenschaftenwert wird angezeigt.

Imports System
Imports Microsoft.VisualBasic
' Enclose a class.
Public Class MyClassA
    ' Public nested class.
    Public Class MyClassB
    End Class 'MyClassB
    Public Shared Sub Main()
        ' Get the type of the nested class.
        Dim myTypeB As Type = GetType(MyClassA.MyClassB)
        ' Get the IsNestedPublic property of the nested class.
        Console.WriteLine(ControlChars.Cr + "The IsNestedPublic property value of the nested class is {0}.", myTypeB.IsNestedPublic.ToString())
    End Sub 'Main
End Class 'MyClassA
using System;
// Enclose a class.
public class MyClassA
{
    // Public nested class.
    public class MyClassB
    {
    }
    public static void Main(string[] args)
    {   
        // Get the type of the nested class.
        Type myTypeB = typeof(MyClassA.MyClassB);
        // Get the IsNestedPublic property of the nested class.
        Console.WriteLine("\nThe IsNestedPublic property value of the nested class is {0}.", myTypeB.IsNestedPublic.ToString());            
    }
}
using namespace System;

// Enclose a class.
public ref class MyClassA
{
public:

   // Public nested class.
   ref class MyClassB{};
};

int main()
{
   
   // Get the type of the nested class.
   Type^ myTypeB = MyClassA::MyClassB::typeid;
   
   // Get the IsNestedPublic property of the nested class.
   Console::WriteLine( "\nThe IsNestedPublic property value of the nested class is {0}.", myTypeB->IsNestedPublic.ToString() );
}
import System.*;

// Enclose a class.
public class MyClassA
{
    // Public nested class.
    public class MyClassB
    {
    } //MyClassB

    public static void main(String[] args)
    {
        // Get the type of the nested class.
        Type myTypeB = MyClassA.MyClassB.class.ToType();
        // Get the IsNestedPublic property of the nested class.
        Console.WriteLine("\nThe IsNestedPublic property value of the nested" 
            + " class is {0}.", System.Convert.ToString(
            myTypeB.get_IsNestedPublic()));
    } //main
} //MyClassA

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

Type-Klasse
Type-Member
System-Namespace
TypeAttributes