This documentation is archived and is not being maintained.

Type.IsNestedPrivate Property

Gets a value indicating whether the Type is nested and declared private.

[Visual Basic]
Public ReadOnly Property IsNestedPrivate As Boolean
[C#]
public bool IsNestedPrivate {get;}
[C++]
public: __property bool get_IsNestedPrivate();
[JScript]
public function get IsNestedPrivate() : Boolean;

Property Value

true if the Type is nested and declared private; otherwise, false.

Remarks

The VisibilityMask selects the visibility attributes.

Example

[Visual Basic, C#, C++] The following example declares a nested class as private and displays the IsNestedPrivate property value of the nested class.

[Visual Basic] 
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

[C#] 
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());    
    }
}

[C++] 
#using <mscorlib.dll>

using namespace System;

// Outer class.
public __gc class MyClassA {
   // Private nested class.
private:
   __gc class MyClassB {
   };
public:
   static void Test() {
      // Get the type of the nested class.
      Type*  myTypeB = __typeof(MyClassA::MyClassB);
      // Get the IsNestedPrivate property of the nested class.
      Console::WriteLine(S"\nThe IsNestedPrivate property value of the nested class is {0}.",__box( myTypeB->IsNestedPrivate));
   }
};

int main() {
   MyClassA::Test();
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Type Class | Type Members | System Namespace | TypeAttributes

Show: