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.
This topic has not yet been rated - Rate this topic

Type.IsNestedFamily Property

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

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

Property Value

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

Remarks

The VisibilityMask selects the visibility attributes.

A Type object's family is defined as all objects of the exact same Type and of its subtypes.

Example

[Visual Basic] 
' Enclose a class.
Class MyClassA

  ' Protected nested class.
   Protected Class MyClassB
   End Class 'MyClassB
End Class 'MyClassA

Class MyTestClass
   Inherits MyClassA
   
   Public Shared Sub Main()
      ' Get the Type of the nested class.
      Dim myTypeB As Type = GetType(MyClassA.MyClassB)
      ' Get the 'IsNestedFamily' property the of the nested class
      ' 'Type'.
      Console.WriteLine((ControlChars.Cr + "The nested class has the property 'IsNestedFamily' value: " + myTypeB.IsNestedFamily.ToString()))
   End Sub 'Main
End Class 'MyTestClass

[C#] 
// Enclose a class.
class MyClassA
{
   // Protected nested class.
   protected class MyClassB
   {
   }   
}
class MyTestClass : MyClassA
{
   public static void Main(string[] args)
   {  
      // Get the Type of the nested class.
      Type myTypeB = typeof(MyClassA.MyClassB);
      // Get the 'IsNestedFamily' property the of the nested class
      // 'Type'.
      Console.WriteLine("\nThe nested class has the property 'IsNestedFamily' value: "+
                        myTypeB.IsNestedFamily.ToString());      
   }
}

[C++] 
// Enclose a class.
__gc class MyClassA {
   // Protected nested class.
protected:
   __gc class MyClassB {
   };
};

__gc class MyTestClass : public MyClassA {
public:
   static void Test() {
      // Get the Type of the nested class.
      Type*  myTypeB = __typeof(MyClassA::MyClassB);
      // Get the 'IsNestedFamily' property the of the nested class
      // 'Type'.
      Console::WriteLine(S"\nThe nested class has the property 'IsNestedFamily' value: {0}", __box( myTypeB->IsNestedFamily));
   }
};

int main() {
   MyTestClass::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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.