Type.IsNotPublic Property
Gets a value indicating whether the Type is not declared public.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Booleantrue if the Type is not declared public and is not a nested type; otherwise, false.
Implements
_Type.IsNotPublicDo not use this property with nested types; use the IsNestedPublic property instead.
If the current Type represents a type parameter of a generic type, this property returns false.
This example usesthe IsNotPublic property to get the visibility of the type.
The following code example demonstrates why you cannot use IsPublic and IsNotPublic for nested classes.
For nested classes, ignore the results of IsPublic and IsNotPublic and pay attention only to the results of IsNestedPublic and IsNestedPrivate. The reflection output for this code fragment would be as follows:
Class | IsNotPublic | IsPublic | IsNestedPublic | IsNestedPrivate |
|---|---|---|---|---|
A | FALSE | TRUE | FALSE | FALSE |
B | FALSE | FALSE | TRUE | FALSE |
C | FALSE | FALSE | FALSE | TRUE |
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0