If need a way of telling a method which property of a object should be set. Here's an example:
public class Person
{
public int A { get; set; }
public int B { get; set; }
}
public class PersonController
{
public void Create(int x)
{
var p = new Person();
// How to tell if A or B should be set?
p.A = x;
// or
p.B = x;
}
}
Now this is a very simple example but imagine that I don't know what kind of object I need to modify.
How can I then tell which property needs to be set - A or B?