G
Guest
I need to get a reference to an objects property by name. I know how to use
the PropertyDescriptor's GetValue and SetValue methods to get and set the
value of an objects property. But my issue is I need to get a reference to
the property itself.
For example I need to do this:
public Person PopulatePerson(Person p)
{
GetReference(p, "FirstName") = "Chris";
return p;
}
The above example is over simplified compared to what I need to do, but the
end result is the same. I wont know what the property is I need to set until
runtime.
Please keep sample to either C# or VB.NET. Thanks
the PropertyDescriptor's GetValue and SetValue methods to get and set the
value of an objects property. But my issue is I need to get a reference to
the property itself.
For example I need to do this:
public Person PopulatePerson(Person p)
{
GetReference(p, "FirstName") = "Chris";
return p;
}
The above example is over simplified compared to what I need to do, but the
end result is the same. I wont know what the property is I need to set until
runtime.
Please keep sample to either C# or VB.NET. Thanks