I try to move my class into a class library project, but I got errors on isClass property in my code. Any help would be appreciated.
code:
using System;
using System.Reflection;
public class MyDemoClass
{
}
public class MyTypeClass
{
public static void Main(string[] args)
{
try
{
Type myType = typeof(MyDemoClass);
// Get and display the 'IsClass' property of the 'MyDemoClass' instance.
Console.WriteLine("\nIs the specified type a class? {0}.", myType.IsClass);
}
catch(Exception e)
{
Console.WriteLine("\nAn exception occurred: {0}." ,e.Message);
}
}
}
Error:
Error CS1061 'Type' does not contain a definition for 'isClass' and no extension method 'isClass' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)