I am working on a plugin system that loads .dll's contained in a specified folder. I am then using reflection to load the assemblies, iterate through the types they contain and identify any that implement my IPlugin interface.
I am checking this with code similar to the following:
foreach(Type t in myTypes )
{
if( typeof(IPlugin)...
Which of the following is better?
a instanceof B
or
B.class.isAssignableFrom(a.getClass())
The only difference that I know of is, when 'a' is null, the first returns false, while the second throws an exception. Other than that, do they always give the same result?
...
While trying to learn Unity, I keep seeing the following code for overriding GetControllerInstance in MVC:
if(!typeof(IController).IsAssignableFrom(controllerType)) { ... }
this seems to me a pretty convoluted way of basically writing
if(controllerType is IController) { ... }
I appreciate there are subtle differences between is and...