Freigeben über


Type.IsNestedPrivate-Eigenschaft

Ruft einen Wert ab, der angibt, ob Type geschachtelt und als privat deklariert ist.

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

Syntax

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

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

Eigenschaftenwert

true, wenn Type geschachtelt und als privat 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 geschachtelte Klasse als privat deklariert, und der IsNestedPrivate-Eigenschaftenwert der geschachtelten Klasse wird angezeigt.

Imports System
Imports Microsoft.VisualBasic
' Outer class.
Public Class MyClassA
    ' Private nested class.
    Private 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 IsNestedPrivate property of the nested class.
        Console.WriteLine(ControlChars.Cr + "The IsNestedPrivate property value of the nested class is {0}.", myTypeB.IsNestedPrivate.ToString())
    End Sub 'Main
End Class 'MyClassA
using System;
// Outer class.
public class MyClassA
{
    // Private nested class.
    private class MyClassB
    {
    }
    public static void Main(string[] args)
    {   
        // Get the type of the nested class.
        Type myTypeB = typeof(MyClassA.MyClassB);
        // Get the IsNestedPrivate property of the nested class.
        Console.WriteLine("\nThe IsNestedPrivate property value of the nested class is {0}.", myTypeB.IsNestedPrivate.ToString());  
    }
}
using namespace System;

// Outer class.
public ref class MyClassA
{
private:

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


public:
   static void Test()
   {
      // Get the type of the nested class.
      Type^ myTypeB = MyClassA::MyClassB::typeid;
      
      // Get the IsNestedPrivate property of the nested class.
      Console::WriteLine( "\nThe IsNestedPrivate property value of the nested class is {0}.", myTypeB->IsNestedPrivate );
   }
};

int main()
{
   MyClassA::Test();
}
import System.*;

// Outer class.
public class MyClassA
{
    // Private nested class.
    private class MyClassB
    {
    } //MyClassB

    public static void main(String[] args)
    {
        // Get the type of the nested class.
        Type myTypeB = MyClassA.MyClassB.class.ToType();

        // Get the IsNestedPrivate property of the nested class.
        Console.WriteLine("\nThe IsNestedPrivate property value of the nested"
            +" class is {0}.",
            System.Convert.ToString(myTypeB.get_IsNestedPrivate()));
    } //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