Type.IsNestedAssembly プロパティ
Type が入れ子になっていて、それ自体が属するアセンブリ内でだけ参照可能かどうかを示す値を取得します。
Public ReadOnly Property IsNestedAssembly As Boolean
[C#]
public bool IsNestedAssembly {get;}
[C++]
public: __property bool get_IsNestedAssembly();
[JScript]
public function get IsNestedAssembly() : Boolean;
プロパティ値
Type が入れ子になっていて、それ自体が属するアセンブリ内でだけ参照可能な場合は true 。それ以外の場合は false 。
解説
VisibilityMask は、参照可能範囲属性を選択します。
使用例
[Visual Basic, C#, C++] 自身のアセンブリ内で参照できる入れ子になったクラスを宣言し、その IsNestedAssembly プロパティ値を表示する例を次に示します。
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] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard