Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Type.IsNestedAssembly Property

Gets a value indicating whether the Type is nested and visible only within its own assembly.

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

Property Value

true if the Type is nested and visible only within its own assembly; otherwise, false.

Remarks

The VisibilityMask selects the visibility attributes.

Example

[Visual Basic, C#, C++] The following example declares a nested class with visibility in its own assembly, and displays its IsNestedAssembly property value.

[Visual Basic] 
Imports System
Imports Microsoft.VisualBasic
' Nest a class.
Class MyClassA
    Friend Class MyClassB
    End Class 'MyClassB
End Class 'MyClassA
Class MyTestClass
    Public Shared Sub Main()
        ' Get the type of the nested class.
        Dim myTypeB As Type = GetType(MyClassA.MyClassB)
        ' Get the IsNestedAssembly property  of the nested class.
        Console.WriteLine(ControlChars.Cr + "The IsNestedAssembly property value of MyClassB is {0}.", myTypeB.IsNestedAssembly.ToString())
    End Sub 'Main
End Class 'MyTestClass

[C#] 
using System;
// Nest a class.
class MyClassA
{
    internal class MyClassB
    {
    }
}
class MyTestClass
{
    public static void Main(string[] args)
    {  
        // Get the type of the nested class.
        Type myTypeB = typeof(MyClassA.MyClassB);
        // Get the IsNestedAssembly property  of the nested class.
        Console.WriteLine("\nThe IsNestedAssembly property value of MyClassB is {0}.", myTypeB.IsNestedAssembly.ToString());
    }
}

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

using namespace System;

// Nest a class.
__gc class MyClassA {
private public:
   __gc class MyClassB {
   };
};

int main() {
   // Get the type of the nested class.
   Type*  myTypeB = __typeof(MyClassA::MyClassB);
   // Get the IsNestedAssembly property  of the nested class.
   Console::WriteLine(S"\nThe IsNestedAssembly property value of MyClassB is {0}.",__box( myTypeB->IsNestedAssembly));
}

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