You can do something like
$bar = New-Object Bar
[IFoo].GetMethod("Foo").Invoke($bar, @())
You get (the reflection representaion of) the member of IFoo
from the Type
object and call an Invoke
overload. Too bad one has to do it that way, though.
Similar approach for explicitly implemented properties etc.
If the method takes arguments, they go in the array @()
after the comma in the code above, of course.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…