C# Why does calling an interface member from a class generate an error?
- by Jack
So I have an interface:
interface IFoo
{
int Bar();
int this[int i] {get; set;}
}
And a class that derives from it
class Foo : IFoo
{
public int IFoo.Bar()
{
//Implementation
{
public int IFoo.this[int i]
{
//Implementation
}
}
Now, I try to do this:
var fooey = new Foo();
int i = Fooey.Bar();
…