mercredi 28 octobre 2015

What is the fastest way to get the value of a property of an object of unknown type?

Need a function which returns the value of a property of an object of unknown type. Currently I have the following.

public static object GetValue(object item, PropertyInfo myproperty)
{
     return myproperty.GetValue(item);
}

This github repository works faster but is there a smaller and/or faster way? thanks.





Aucun commentaire:

Enregistrer un commentaire