static object GetValue(MemberInfo mi, object o)
{
var fi = mi as FieldInfo;
if (fi != null)
return fi.GetValue(o);
var pi = mi as PropertyInfo;
if (pi == null)
return null;
var getMethod = pi.GetGetMethod();
return getMethod.Invoke(o, new object[0]);
}