0
Reply

Dynamically reference properties

Anonymous

Anonymous

Oct 29 2008 5:04 PM
2.6k
Can you reference properties dynamically without using reflections.

i want to do the following,

class test
{
    public decimal x
    {
        get {return _x;}
        set {_x = value;}
    }
    public decimal y
    {
        get {return _y;}
        set {_y = value;}
    }

}

test.x = test.x*2;
test.y = test.y*2;

i dont want to repeat this code. So i want to softcode x and y. is it possible?