vendredi 20 octobre 2017

getting properties using reflection

im using reflection for getting some properties, and im having problems getting one when the GetValue(item,null) returns an object. i did:

foreach (var item in items)
{
   item.GetType().GetProperty("Site").GetValue(item,null)
}

doing that, i got an object System.Data.Entity.DynamicProxies.Site. Debugging it, i can see all properties of that object, but i can`t get it. For example, one property is: siteName, how can i get the value of that? Thanks.





Aucun commentaire:

Enregistrer un commentaire