Type.IsNestedAssembly 属性

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

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

语法

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

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

属性值

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

备注

如果当前 Type 表示某种泛型类型的类型参数,则此属性始终返回 false

TypeAttributes.VisibilityMask 选择可见性属性 (Attribute)。

示例

下面的示例声明一个在本身的程序集中具有可见性的嵌套类,并显示其 IsNestedAssembly 属性 (Property) 值。

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
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());
    }
}
using namespace System;

// Nest a class.
ref class MyClassA
{
internal:
   ref class MyClassB{};
};

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

// Nest a class.
class MyClassA
{
    class MyClassB
    {
    } //MyClassB
} //MyClassA

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

        // Get the IsNestedAssembly property  of the nested class.
        Console.WriteLine("\nThe IsNestedAssembly property value of "
            +"MyClassB is {0}.",System.Convert.ToString(
            myTypeB.get_IsNestedAssembly()));
    } //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