Код: Выделить всё
public interface IHasValue {
int GetValue();
// interface method with implementation;
bool IsZero() => GetValue() == 0;
}
public class TestHasValue : IHasValue {
private int value;
public int GetValue() => value;
// Error: Cannot resolve symbol 'IsZero'
bool test1() => IsZero();
// Compiles fine
bool test2() => ((IHasValue) this).IsZero();
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... in-c-sharp
Мобильная версия