I'm encountering a problem with interface properties in C#. The predefined property DefinedProperty is not visible in the context of the class that implements the interface. Here is a code example:
interface IBase
{
int Integer { get; set; }
string DefinedProperty => Integer.ToString();
}
class Class : IBase
{
public int Integer { get; set; }
public void Foo()
{
Console.WriteLine(DefinedProperty); // Compile time error here
}
}
I'm hoping someone can provide a clear explanation if there is one.