I've a class with private members and public property on them. I want to be able to instance class members by name. For example.
public class Position
{
private int _x;
private int _y;
public Position(){}
public int x
{
get {return _x;}
set {_x = value;}
}
public int y
{
get {return _y;}
set {_y = value;}
}
}
I want in code to be able to write also:
Position Position1 = new Position;
Position1("x") = 1;
Position1("y") = 2;
Please help!
public class Position
{
private int _x;
private int _y;
public Position(){}
public int x
{
get {return _x;}
set {_x = value;}
}
public int y
{
get {return _y;}
set {_y = value;}
}
}
I want in code to be able to write also:
Position Position1 = new Position;
Position1("x") = 1;
Position1("y") = 2;
Please help!