C# Type IsNotPublic

Description

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

Syntax

Type.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 ww .  j  ava 2s. co m

using System;
using System.IO;
using System.Reflection;
class MyMemberInfo 
{ 
    public static void Main(string[] args) 
    { 
        Type MyType =Type.GetType("System.IO.File");
        MemberInfo[] Mymemberinfoarray = MyType.GetMembers();
        Console.WriteLine(MyType.IsNotPublic.ToString());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version