private static RandomValues GetPropertyValues(object target) { var propertyMap = new RandomValues(); try { var properties = target.GetType().GetProperties(); foreach (var prop in properties) { try { var key = prop.Name; var value = prop.GetValue(target).ToString(); propertyMap.Add(key, value); } catch { // following best practices and swallowing all exceptions :oP } } } catch { // ...and release! i'm no fisherman } return(propertyMap); }
private static RandomValues GetPropertyValues(object target) { var propertyMap = new RandomValues(); try { var properties = target.GetType().GetProperties(); foreach (var prop in properties) { try { var key = prop.Name; var value = prop.GetValue(target).ToString(); propertyMap.Add(key, value); } catch { // following best practices and swallowing all exceptions :oP } } } catch { // ...and release! i'm no fisherman } return propertyMap; }