C# TypeInfo IsPublic

Description

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

Syntax

TypeInfo.IsPublic has the following syntax.


public bool IsPublic { get; }

Example

The following example creates an instance of MyTestClass, checks for the IsPublic property, and displays the result.


/*from   ww w .j a va2  s .c  om*/
using System;
namespace SystemType
{
    public class MyTestClass
    {
    }
    public class MyClass
    {
        public static void Main(string []args)
        {
            bool myBool = false;
            MyTestClass myTestClassInstance = new MyTestClass();
            Type   myType = myTestClassInstance.GetType();
            myBool = myType.IsPublic;
            Console.WriteLine("\nIs {0} public? {1}.", myType.FullName, myBool.ToString ());
        }
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo