I'm debugging the following code:
class A
{
public virtual string X => "A";
}
class B : A
{
public bool OwnX { get; set; } = true;
public override string X
=> OwnX ? "B" : base.X; // (o)
}
class Program
{
static void Main() => Console.WriteLine(new B().X);
}
And I have a breakpoint on the line marked with (o)
. When the breakpoint hit, I'm trying to evaluate base.X
and getting its value "B"
:
The question is: why not "A"
?