dotnow-interpreter
dotnow-interpreter copied to clipboard
Roslyn C# integration and interfaces
The following will always return null for interfaces:
ScriptType type = assembly.FindSubTypeOf<ITest>();
Workaround for the moment is to use GetInterface
but a more permanent solution should be found and it will be quite a common use case:
ScriptType type = null;
foreach( ScriptType t in assembly.FindAllTypes() )
{
// if( typeof(ITest).IsAssignableFrom( t.SystemType ) ) <- DOESN'T WORK
if( t.SystemType.GetInterface( nameof(ITest) ) == typeof(ITest) )
{
type = t;
break;
}
}