Let's start with code from MS page:
interface ILeft
{
int P { get;}
}
interface IRight
{
int P();
}
class Middle : ILeft, IRight
{
public int P() { return 0; }
int ILeft.P { get { return 0; } }
}
I would like to change Middle
in such way, the EII property is once initialized, something like this:
class Middle : ILeft, IRight
{
public int P() { return 0; }
int ILeft.P { get; }
Middle()
{
ILeft.P = 0;
}
}
Above code does not compile, thus my question -- is there a syntax for doing this?
I am asking about syntax, because brute force way would be to declare private field and redirect ILeft.P
getter to return data from it.