public static List <ExtractedProperty <T> > ExtractProperties <T>(this object source) { var results = new List <ExtractedProperty <T> >(); foreach (var property in source.GetType().GetProperties()) { if (property.PropertyType.Is <T>()) { var value = (T)property.GetValue(source, null); if (value != null) { var extractedProperty = new ExtractedProperty <T> { Property = property, Value = value }; results.Add(extractedProperty); } } } return(results); }
private string GetPropertyType(ExtractedProperty property) => property.Type.FormatType(_formatter);
public PropertyTester(ExtractedProperty property, TypeFormatter typeFormatter) { _property = property; _typeFormatter = typeFormatter; }