Using reflection I can do ToString on a property. But is there a way to supply a formatting while doing this?
public static object GetCustomValue(object src, string propName)
{
return src.GetType().GetMethod(propName).GetValue(src, null);
}
Calling the function like this works fine
GetCustomValue(obj, "ToString")
But I would like to call it with
GetCustomValue(obj, "ToString(\"MMM\")")
Is it possible to add formatting to the ToString when calling the GetMethod in my function?
Aucun commentaire:
Enregistrer un commentaire