I'm creating a function will read all properites from an object check from certain value and modify it, I want to return back the final object with the modified result.
private static object GetFullPropertyPaths(object finalResult)
{
foreach (PropertyInfo propertyInfo in finalResult.GetType().GetProperties())
{
if (propertyInfo.PropertyType == typeof(string))
{
object propertyValue = propertyInfo.GetValue(finalResult);
if (propertyValue.ToString().StartsWith("\\"))
{
string result = Sys.Config.ConfigurationRootFolder + propertyValue.ToString();
propertyInfo.SetValue(finalResult, result);
}
}
}
return finalResult;
}
I know I migh need to use some sort of Deep copy of an object, I want to make sure I'm on the right track or if I missing something. Thanks
Aucun commentaire:
Enregistrer un commentaire