public static bool GetDeep <T>(Type objType, object instance, string[] nestedNames, out T result) { object prevObj = instance; int len = nestedNames.Length; for (int i = 0; i < len; i++) { string name = nestedNames[i]; if (!ReflectionHelpers.Get(prevObj, name, out prevObj)) { result = default(T); return(false); } } result = (T)prevObj; return(true); }
//////////////// public static bool Get <T>(object instance, string fieldOrPropName, out T result) { return(ReflectionHelpers.Get <T>(instance.GetType(), instance, fieldOrPropName, out result)); }