Wednesday, November 26, 2014

How to get property from type object , which is a wrapper of type with this property?

I did so:



object o = SelectedObject;
Type t = o.GetType();
System.Reflection.PropertyInfo info = t.GetProperty("X");
decimal? xx = (decimal?)info.GetValue(o, null);

Is there a more direct way?

No comments:

Post a Comment