user2745829
user2745829

Reputation:

Finding all Interface that a class implements

Can someone tell me how to find all interfaces that a class implements by using C# reflection ?

Like find all classes that implement a specific interface

if(type.getInterface(typeof(IAuto)) != null)
{
   console.writeline(type.name.tostring());
}

Upvotes: 3

Views: 137

Answers (1)

Flat Eric
Flat Eric

Reputation: 8111

var interfaces = typeof(Classname).GetInterfaces();

Upvotes: 8

Related Questions