/// <summary> /// /// </summary> /// <param name="dictionary"></param> /// <param name="value"></param> public static void AddAnonymousObjectToDictionary(IDictionary <string, object> dictionary, object value) { ObjectValueDictionary objectValueDictionary = TypeHelper.ObjectToDictionary(value); foreach (KeyValuePair <string, object> current in objectValueDictionary) { dictionary.Add(current); } }
/// <summary> /// /// </summary> /// <param name="value"></param> /// <returns></returns> public static ObjectValueDictionary ObjectToDictionaryUncached(object value) { ObjectValueDictionary routeValueDictionary = new ObjectValueDictionary(); if (value != null) { PropertyHelper[] properties = PropertyHelper.GetProperties(value); for (int i = 0; i < properties.Length; i++) { PropertyHelper propertyHelper = properties[i]; routeValueDictionary.Add(propertyHelper.Name, propertyHelper.GetValue(value)); } } return(routeValueDictionary); }