Code:
add-type @"
public interface IFoo
{
void Foo();
}
public class Bar : IFoo
{
void IFoo.Foo()
{
}
}
"@ -Language Csharp
$bar = New-Object Bar
($bar -as [IFoo]).Foo() # ERROR.
Error:
Method invocation failed because [Bar] doesn't contain a method named 'Foo'.