Is there any way to do this? I try to test if a property of an object exists and if it does, I want to set a value to it. (Maybe the complete idea is bad, if true - why?)
var propertyInfo = info.GetType().GetProperty(propertyName);
if (propertyInfo != null) //this probably works. Yes it is
{
propertyInfo.SetValue(info, value, null);
}