Check if a type is a class in CSharp

Description

The following code shows how to check if a type is a class.

Example


using System;/*  w w  w.j a  v  a2  s . c o  m*/
using System.Reflection;
   
class NameType
{
  public static void Main()
  {
        Type t = Type.GetType("System.String");
        Console.WriteLine("Is Class : {0}",t.IsClass);
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Reflection »




Array
Constructor
Event
Field
Interface
Method
Properties
Type