2
I want to see if a Type
is implemented by the interface System.IDirectOutput
and access their methods, but I don’t know how, I’m trying to:
If GetType(IDirectOutput).IsAssignableFrom(Expression) Then
Return CType(Expression, IDirectOutput).InstanceOutput
Else
Throw New InvalidOperationException($"The specified type is not implemented from {NameOf(IDirectOutput)}.")
End If
but it doesn’t work :(. Help me!
Updating
I tried that method and it worked: (in response to qmechanik)
If TypeOf Expression Is IDirectOutput Then
'statements...
End If
Have you tried using the
TypeOf
?If TypeOf IDirectOutput Is Expression Then
.– stderr
That’s what I just tried :P
– CypherPotato
:D in C#, if you’re interested, you can do (haven’t tested):
if (typeof(IDirectOutput).IsAssignableFrom(Expression)) { ... }
– stderr
Could be, I don’t like programming in C# even :P
– CypherPotato
I posted an answer, when possible, I put up a verifiable example.
– stderr