8
I have an interface similar to this:
public interface InterfaceA<T>
{
T Exemplo();
}
And other classes implement it.
public class ExemploA : InterfaceA<Int32>
{
Int32 Exemplo();
}
public class ExemploB : InterfaceA<String>
{
String Exemplo();
}
Researching found this reply on Soen, but I cannot get the type
of the interface without the generics
.
var type = typeof(InterfaceA); //erro
Does anyone know how I can get the type
of the classes ExemploA
, ExemploB
, searching for the InterfaceA
, within a given assembly
?
You want to get all classes that implement
InterfaceA
. Right?– Jéf Bueno
That’s right, no matter what
InterfaceA<Int32>
orInterfaceA<String>
, list all that implementInterfaceA
– Marco Giovanni
@Marcogiovanni did one more edit making the
Linq
search by type GenericInterfaceA<>
is a good one too ...– novic