I've got a base class "Parent" such as this:

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Parent
    {
        private int parentVirtualInt = -1;
        public virtual int VirtualProperty
        {
            get
            {
                return parentVirtualInt;
            }
            set
            {
                if(parentVirtualInt != value)
                {
                    parentVirtualInt = value;
                }
            }
        }
    }
}

along with a child class such as this:

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Child : Parent
    {
        public override int VirtualProperty
        {
            get
            {
                if(base.VirtualProperty > 0)
                {
                    throw new ApplicationException("Dummy Ex");
                }
                return base.VirtualProperty;
            }
            set
            {
                if(base.VirtualProperty != value)
                {
                    base.VirtualProperty = value;
                }
            }
        }
    }
}

Observe that the getter in Child is asking the getter of Parent (or at best this is exactly what I intend).

Now i make use of the "Child" class by instantiating it, setting something (let us say 4) to the VirtualProperty after which reading through the home again.

Child c = new Child();
c.VirtualProperty = 4;
Console.Out.WriteLine("Child.VirtualProperty: " + c.VirtualProperty);

After I run this, I clearly have an ApplicationException saying "Dummy Ex". But basically set a breakpoint at risk

if(base.VirtualProperty > 0)

in Child and appearance the need for base.VirtualProperty (by hanging a button regarding this) prior to the exception could be tossed (I suppose(d)), I already obtain the Exception. Out of this I convey the statement base.VirtualProperty within the "Child-Getter calls itself" type of.

What I must achieve is identical behavior I recieve after i change the phrase parentVirutalInt (in Parent) to protected and employ base.parentVirtualInt within the Getter of Child rather than base.VirtualProperty. And That I don't yet understand why this isn't working. Can anybody shed some light about this? Personally i think that overridden qualities behave in a different way than overridden techniques?

Incidentally: I'm doing something much the same with subclassing a category I have no treatments for (this is actually the primary reason my "workaround" isn't a choice).

Xox

It's (perhaps) a bug within the debugger. You can include your election for this feedback article. This is not simple to fix, I am sure, the debugger does not have ready accessibility base property getter method address because the v-table slot for that property getter continues to be changed within the derived class.

One possible workaround would be to keep base value inside a local variable first so that you can inspect that certain. That is not will make your getter any reduced.