Per popolare un oggetto (nel suo costruttore) via Reflection utilizzare questo codice:
public Oggetto(Oggetto obj)
{
var fromFields = typeof(Oggetto).GetProperties();
foreach (var pi in fromFields)
{
pi.SetValue(this, pi.GetValue(obj, null), null);
}
}
giovedì 9 gennaio 2014
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento