private static ViewDataInfo GetIndexedPropertyValue(object indexableObject, string key) { IDictionary <string, object> dict = indexableObject as IDictionary <string, object>; object value = null; bool success = false; if (dict != null) { success = dict.TryGetValue(key, out value); } else { TryGetValueDelegate tgvDel = TypeHelpers.CreateTryGetValueDelegate(indexableObject.GetType()); if (tgvDel != null) { success = tgvDel(indexableObject, key, out value); } } if (success) { return(new ViewDataInfo() { Container = indexableObject, Value = value }); } return(null); }
private static ViewDataInfo GetIndexedPropertyValue(object indexableObject, string key) { IDictionary <string, object> dictionary = indexableObject as IDictionary <string, object>; object obj = (object)null; bool flag = false; if (dictionary != null) { flag = dictionary.TryGetValue(key, out obj); } else { TryGetValueDelegate getValueDelegate = TypeHelpers.CreateTryGetValueDelegate(indexableObject.GetType()); if (getValueDelegate != null) { flag = getValueDelegate(indexableObject, key, out obj); } } if (!flag) { return((ViewDataInfo)null); } return(new ViewDataInfo() { Container = indexableObject, Value = obj }); }