I want to see if a Type
is implemented by the System.IDirectOutput
interface and access its methods, but I do not know how, I'm trying this:
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 does not work :( Help me!
Update
I tried this method and it worked: ( in response to qmechanik )
If TypeOf Expression Is IDirectOutput Then
'statements...
End If