Suppose I have an interface called IVerifier
public interface IVerifier
{
bool Validate(byte[]x, byte[]y);
}
and I had to load an assembly by reflection, and that assembly holds the same signature, how possible it is to do this:
IVerifier c = GetValidations();
c.Validate(x,y);
And inside GetValidations() is the reflection resides!
I’ve been thinking about this a lot, and all I get is that invoking the reflected method is going to be inside GetValidations(), but it must be away to do it like above.
Assuming that you don’t know the type you want to instantiate in another assembly, you just know it implements
IVerifieryou can use a method like this:Sample use: