Given the following types:
public interface Interface { }
public abstract class Abstract { }
Why is this:
typeof(Interface).IsAbstract == true;
Note the IsInterface
exists to check if it is an interface:
typeof(Abstract).IsInterface == false;
From the docs:
So an interface is considered abstract because it cannot be instantiated.
If you want to determine that a type is an abstract class, you should do the following: