Type.IsNotPublic プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


入れ子にされた型で使用しないでください。代わりに、IsNestedPublic を使用してください。

IsNotPublic を使用して、型の参照可能範囲を取得するコード例を次に示します。
Imports System Imports System.IO Imports System.Reflection Imports Microsoft.VisualBasic Class MyMemberInfo Public Shared Sub Main() Console.WriteLine(ControlChars.Cr + "Reflection.MemberInfo") 'Get the Type and MemberInfo. Dim MyType As Type = Type.GetType("System.IO.File") Dim Mymemberinfoarray As MemberInfo() = MyType.GetMembers() 'Get and display the DeclaringType method. Console.WriteLine(ControlChars.Cr + "There are {0} members in {1}.", _ Mymemberinfoarray.Length, MyType.FullName) Console.WriteLine("Is {0} nonpublic? {1}", MyType.FullName, _ MyType.IsNotPublic.ToString()) End Sub End Class
using System; using System.IO; using System.Reflection; class MyMemberInfo { public static void Main(string[] args) { Console.WriteLine ("\nReflection.MemberInfo"); //Get the Type and MemberInfo. Type MyType =Type.GetType("System.IO.File"); MemberInfo[] Mymemberinfoarray = MyType.GetMembers(); //Get and display the DeclaringType method. Console.WriteLine("\nThere are {0} members in {1}.", Mymemberinfoarray.Length, MyType.FullName); Console.WriteLine("Is {0} nonpublic? {1}", MyType.FullName, MyType.IsNotPublic.ToString()); } }
using namespace System; using namespace System::IO; using namespace System::Reflection; int main() { Console::WriteLine( "\nReflection.MemberInfo" ); //Get the Type and MemberInfo. Type^ MyType = Type::GetType( "System.IO.File" ); array<MemberInfo^>^Mymemberinfoarray = MyType->GetMembers(); //Get and display the DeclaringType method. Console::WriteLine( "\nThere are {0} members in {1}.", Mymemberinfoarray->Length, MyType->FullName ); Console::WriteLine( "Is {0} nonpublic? {1}", MyType->FullName, MyType->IsNotPublic ); }
import System.*; import System.IO.*; import System.Reflection.*; class MyMemberInfo { public static void main(String[] args) { Console.WriteLine("\nReflection.MemberInfo"); //Get the Type and MemberInfo. Type myType = Type.GetType("System.IO.File"); MemberInfo mymemberinfoarray[] = myType.GetMembers(); //Get and display the DeclaringType method. Console.WriteLine("\nThere are {0} members in {1}.", System.Convert.ToString(mymemberinfoarray.length), myType.get_FullName()); Console.WriteLine("Is {0} nonpublic? {1}", myType.get_FullName() , System.Convert.ToString(myType.get_IsNotPublic())); } //main } //MyMemberInfo
import System; import System.IO; import System.Reflection; class MyMemberInfo { public static function Main() : void { Console.WriteLine ("\nReflection.MemberInfo"); //Get the Type and MemberInfo var MyType : Type =Type.GetType("System.IO.File"); var Mymemberinfoarray : MemberInfo[] = MyType.GetMembers(); //Get and display the DeclaringType method Console.WriteLine("\nThere are {0} members in {1}.", Mymemberinfoarray.Length, MyType.FullName); Console.WriteLine("Is {0} public? {1}", MyType.FullName , MyType.IsPublic.ToString()); } } MyMemberInfo.Main();
There are 27 members in System.IO.File.
Is System.IO.File public?False
入れ子になったクラスに対して IsPublic および IsNotPublic を使用できない理由を次のコード例で示します。
入れ子になったクラスの場合は、IsPublic および IsNotPublic の結果は無視し、IsNestedPublic および IsNestedPrivate の結果だけに注目してください。このコード片のリフレクション出力は、たとえば次のようになります。

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


_Type.IsNotPublic プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


このプロパティは、アンマネージ コードからマネージ クラスにアクセスするためのプロパティであるため、マネージ コードからは呼び出さないでください。
Type.IsNotPublic プロパティは、最上位の Type がパブリックとして宣言されていないかどうかを示す値を取得します。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からType.IsNotPublicを検索する場合は、下記のリンクをクリックしてください。

- Type.IsNotPublicのページへのリンク