P
Peter Morris
interface Interface1
{
}
interface Interface2 : Interface1
{
}
class A : Interface2
{
}
static void Main(string[] args)
{
Console.WriteLine(typeof(A).IsSubclassOf(typeof(Interface1)).ToString());
Console.WriteLine(typeof(A).IsSubclassOf(typeof(Interface2)).ToString());
Console.ReadLine();
}
Both return False. Given a type what is the simplest way of checking if it
implements Interface1 either directly, or by implementing Interface2?
{
}
interface Interface2 : Interface1
{
}
class A : Interface2
{
}
static void Main(string[] args)
{
Console.WriteLine(typeof(A).IsSubclassOf(typeof(Interface1)).ToString());
Console.WriteLine(typeof(A).IsSubclassOf(typeof(Interface2)).ToString());
Console.ReadLine();
}
Both return False. Given a type what is the simplest way of checking if it
implements Interface1 either directly, or by implementing Interface2?