C# Program to Check a Specified Type is a Primitive Data Type or Not Last Updated : 16 Nov, 2021 Comments Improve Suggest changes Like Article Like Report In C#, data types are used to specify the type of data that a variable can hold. There are two types of data types available in C# that is, primitive and non-primitive data types. Primitive data types are predefined data types such as Byte, SByte, Boolean, Int16, UInt16, Int32, UInt32, Char, Double, Int64, UInt64, Single, etc. Whereas non-primitive data types are user-defined data types such as enum, class, etc. In this article, we will learn how to check a specified type is a primitive data type or not. So, to do this task we use the IsPrimitive property of the Type class. This property is used to check whether the type of the specified data is one of the primitive types or not. It returns true if the given data type is primitive otherwise it will return false. Syntax: public bool IsPrimitive{ get; }Example: C# // C# program to check a specified type // is a primitive data type or not using System; using System.Reflection; class GFG{ static void Main() { // Check the int is an primitiva or not if (typeof(int).IsPrimitive == true) { Console.WriteLine("Primitive data type"); } else { Console.WriteLine("Not a primitive data type"); } // Check the float is an primitiva or not if (typeof(float).IsPrimitive == true) { Console.WriteLine("Primitive data type"); } else { Console.WriteLine("Not a primitive data type"); } // Check the int is an primitiva or not if (typeof(double).IsPrimitive == true) { Console.WriteLine("Primitive data type"); } else { Console.WriteLine("Not a primitive data type"); } } } Output: Primitive data type Primitive data type Primitive data type Comment More infoAdvertise with us Next Article C# Program to Check a Specified Type is a Primitive Data Type or Not 171fa07058 Follow Improve Article Tags : C# C# Programs CSharp-data-types Similar Reads 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 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 Interface or not The interface is just like a class, it can also have methods, properties, events, etc. as its members, but it only contains the declaration of the members and the implementation of these members will be given by the class that implements the interface implicitly or explicitly. We can check the speci 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 Like