C# TypeInfo IsNotPublic

Description

TypeInfo IsNotPublic Gets a value indicating whether the Type is not declared public.

Syntax

TypeInfo.IsNotPublic has the following syntax.


public bool IsNotPublic { get; }

Example

This example shows the use of IsNotPublic to get the visibility of the type.


//w  w w. j av a2 s  .c o m
using System;
using System.IO;
using System.Reflection;
class MyMemberInfo 
{ 
    public static void Main(string[] args) 
    { 
        Console.WriteLine ("\nReflection.MemberInfo");

        Type MyType =Type.GetType("System.IO.File");
        MemberInfo[] Mymemberinfoarray = MyType.GetMembers();

        Console.WriteLine("\nThere are {0} members in {1}.", Mymemberinfoarray.Length, MyType.FullName);
        Console.WriteLine("Is {0} nonpublic? {1}", MyType.FullName, MyType.IsNotPublic.ToString());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo