In article <eF**************@TK2MSFTNGP10.phx.gbl>,
Ro********@student.tul.edu (Rob Tillie) writes:
you can do this with the object itself. When you have an object o which
implements an interface i,
"o is i" will return true. So you can write: if(o is i) { // o implements
the interface i}
Yes, thanks, but my problem was that I don't have an object. The
program checks if the class (represented by a Type object) implements
the interface, and if it does, an object is instantiated with
Activator.CreateInstance().
The way to solve the problem was posted by Mike Schilling, where t
is the Type object:
bool tIsIMyInterface = typeof(IMyInterface).IsAssignableFrom(t);
(I assume that the only way an interface can be assignable from a
type is if the type implements the interface...)
Gomaw