vendredi 23 octobre 2015

Is there a way to change property names through reflection in C#?

I am using a system where field names need to be prefixed with a given namespace dynamically.

Is there any way I can do something which can achieve something like this -

var properties = item.GetType().GetProperties();
foreach (var pi in properties)
{
    pi.Name = Settings.Default.NameSpace + "_" + pi.Name;
}





Aucun commentaire:

Enregistrer un commentaire