Doing something like this
...
if (!settingsType.IsAssignableFrom(typeof (ISettingsSource)))
throw new IncorrectCustomizationSourceTypeException(settingsType.Name, nameof(ISettingsSource));
...
and actually i got my lovely exception in spite of settingsType is instance of class which derived from a class that implements required interface
. As I've understood that method check casting ability to type passed in parameter and in my case it should work.
What is the proper way to check such condition than?
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire