C# Program to Check a Specified Type is an Array or Not Last Updated : 07 Jan, 2022 Comments Improve Suggest changes Like Article Like Report 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 type is an array or not. IsArray property will return true if the specified type is an array. Otherwise, it will return false. Syntax: public bool IsArray{get;}Return: It will return true if the value is an array otherwise false. Approach Import System.Reflection namespace.Declare an array with a datatype of a size n.Use IsArray is the method to check the type is array or not along with GetType() method. GetType() method method gets the type of the variable.array.GetType().IsArrayIf the condition is true then display "Type is array" or if the condition is false then display "Type is not array".Example 1: C# // C# program to determine whether the // specified type is an array or not using System; using System.Reflection; class GFG{ static void Main() { // Declare an array with size 5 // of integer type int[] array1 = new int[5]; // Check whether the variable is array or not // Using IsArray property if (array1.GetType().IsArray == true) { Console.WriteLine("Type is array"); } else { Console.WriteLine("Type is not array"); } } } Output: Type is arrayExample 2: C# // C# program to determine whether the // specified type is an array or not using System; using System.Reflection; class GFG{ static void Main() { // Declare and initializing variables int array1 = 45; string array2 = "GeeksforGeeks"; int[] array3 = new int[3]; double[] array4 = { 2.3, 4.5, 0.33 }; // Check whether the variable is of array type or not // Using IsArray property Console.WriteLine("Is the type of array1 variable is array?" + array1.GetType().IsArray); Console.WriteLine("Is the type of array2 variable is array?" + array2.GetType().IsArray); Console.WriteLine("Is the type of array2 variable is array?" + array3.GetType().IsArray); Console.WriteLine("Is the type of array2 variable is array?" + array4.GetType().IsArray); } } OutputIs the type of array1 variable is array?False Is the type of array2 variable is array?False Is the type of array2 variable is array?True Is the type of array2 variable is array?True Comment More infoAdvertise with us Next Article C# Program to Check a Specified Type is an Array or Not 171fa07058 Follow Improve Article Tags : C# C# Programs CSharp-Arrays-Programs 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 Primitive Data Type or Not 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, 2 min read C# | Check if an array is read-only or not Array.IsReadOnly Property is used to get a value that indicates whether the Array is read-only or not. Syntax: public bool IsReadOnly { get; } Property Value: This property always returns false for all arrays. Below programs illustrate the use of above-discussed property: Example 1: CSharp // C# pro 2 min read C Program to Check Whether Two Matrices Are Equal or Not Here, we will see how to check whether two matrices are equal or not using a C Program Input: First Matrix: 1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4 Second matrix: 1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4 Output: Matrices are equal.Approach: For any two matrices to be equal, the number of rows 2 min read Like