Type.IsNestedFamily 属性

获取一个值,通过该值指示 Type 是否是嵌套的并且只在它自己的家族内可见。

**命名空间:**System
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Public ReadOnly Property IsNestedFamily As Boolean
用法
Dim instance As Type
Dim value As Boolean

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

属性值

如果 Type 是嵌套的并且仅在它自己的家族中可见,则为 true;否则为 false

备注

如果当前 Type 表示泛型类型的类型形参,则此属性 (Property) 始终返回 false

TypeAttributes.VisibilityMask 选择可见性属性。

Type 对象的家族被定义为具有完全相同的 Type 及其子类型的所有对象。

示例

' 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
// 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());      
   }
}
// Enclose a class.
ref class MyClassA
{
protected:

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

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

int main()
{
   MyTestClass::Test();
}
// Enclose a class.
class MyClassA
{
    // Protected nested class.
    protected class MyClassB
    {
    } //MyClassB
} //MyClassA

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

        // Get the 'IsNestedFamily' property the of the nested class 'Type'.
        Console.WriteLine("\nThe nested class has the property "
            +"'IsNestedFamily' value: " 
            + System.Convert.ToString(myTypeB.get_IsNestedFamily()));
    } //main
} //MyTestClass

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

Type 类
Type 成员
System 命名空间
TypeAttributes