C# Program to Check a Specified Type is Public or not Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report A class is a collection of methods, variables, and objects. We can create a public class, private class, or protected class using the access modifiers. A class created with the public modifier will have access entirely to a program. So to check whether the given class or type is a public type or not we use the IsPublic property of the Type class. It will return true if the given type is a public type. Otherwise, it will return false. Also, this property will not work with nested types. Syntax: public bool IsPublic { get; }Example 1: C# // C# program to check whether the given class or // type is a public type or not using System; using System.Reflection; // Declare a class with public modifier public class Myclass1 { public void display() { Console.WriteLine("Hello! GeeksforGeeks"); } } // Declare a class without public modifier class Myclass2 { public void Show() { Console.WriteLine("Hey! GeeksforGeeks"); } } public class GFG{ // Driver code public static void Main(string[] args) { // Check whether the given type is a public or not // Using IsPublic property Console.WriteLine(typeof(Myclass1).IsPublic); Console.WriteLine(typeof(Myclass2).IsPublic); } } Output: True FalseExample 2: C# // C# program to check whether the given class or // type is a public type or not using System; using System.Reflection; // Declare a class with public modifier public class Student { public void display() { Console.WriteLine("I like C# language alot"); } } public class GFG{ // Driver code public static void Main(string[] args) { // Check whether the given type is a public or not // Using IsPublic property if (typeof(Student).IsPublic == true) { Console.WriteLine("The given class is a public class"); } else { Console.WriteLine("The given class is not a public class"); } } } Output: The given class is a public class Comment More infoAdvertise with us Next Article C# Program to Check a Specified Type is a Pointer or not S sireeshakanneganti112 Follow Improve Article Tags : C# C# Programs Similar Reads C# Program to Check a Specified Type is Nested or not In programming languages, nested means a class or a method or loop or structure is present inside another class or a method or loop or structure. In C#, we can check a specified type is nested or not using the IsNested property of the Type class. This property returns a value that represents whether 2 min read C# Program to Check a Specified Type is a Class or Not A class is a collection of methods, variables, and objects. Or we can say that a class is a blueprint using which an object is created. So to check whether the specified type is a class as well as delegates or not we use the IsClass property of the Type class. It will return true if the type is clas 2 min read C# Program to Check a Specified Type is an Enum or Not Enum or also known as Enumeration is used to store user define data. It is used to assign the string value to an integral constant which makes programs easy to read and manage. We can create enum data using the enum keyword followed by the enum name. In C#, we can check the specific type is enum or 2 min read C# Program to Check a Specified Type is an Array or Not In C#, an array is a group of homogeneous elements that are referred to by a common name. So in this article, we will discuss how to check the variable is of array type or not. To do this task, we use the IsArray property of the Type class. This property is used to determine whether the specified ty 2 min read C# Program to Check a Specified Type is a Pointer or not A pointer is a variable that contains the references of another variable. Or in other words, the pointer is a variable that stores the address of the same type of variable. For example, a string pointer can store the address of a string. In C#, we can able to check the given type is a pointer or not 2 min read C# Program to Check a Specified Type is a Value Type or Not In C#, the value type represents a sequence of bits. It is not a class or an interface, it is referred to as a struct or enum(a special case of value type). So to check whether the specified type is Value Type or not we use the IsValueType property of the Type class. It is a read-only property. It w 2 min read Like