Export (0) Print
Expand All

Type.IsNestedPublic Property

Gets a value indicating whether a class is nested and declared public.

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

Property Value

true if the class is nested and declared public; otherwise, false.

Remarks

The VisibilityMask selects the visibility attributes.

Example

[Visual Basic, C#, C++] The following example declares a public nested class and displays its IsNestedPublic property value.

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

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

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

using namespace System;
// Enclose a class.
public __gc class MyClassA {
public:
   // Public nested class.
   __gc class MyClassB {
   };
};
int main() {
   // Get the type of the nested class.
   Type*  myTypeB = __typeof(MyClassA::MyClassB);
   // Get the IsNestedPublic property of the nested class.
   Console::WriteLine(S"\nThe IsNestedPublic property value of the nested class is {0}.", myTypeB->IsNestedPublic.ToString());            
}

[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:
© 2014 Microsoft