PropertyInfo FindSameProperty(PropertyInfo sourceProp, PropertyInfo[] compareProps) { if (TypeDeterminer.IsSimple(sourceProp.PropertyType)) { string sourcePropName = GetPropertyInfoFullName(sourceProp); return(compareProps.FirstOrDefault(c => sourcePropName.Equals(GetPropertyInfoFullName(c)))); } else { return(compareProps.FirstOrDefault(prop => prop.PropertyType.FullName.Equals(sourceProp.PropertyType.FullName))); } }
FieldInfo FindSameField(FieldInfo sourceField, FieldInfo[] compareFields) { if (TypeDeterminer.IsSimple(sourceField.FieldType)) { string sourceFieldName = GetFieldInfoFullName(sourceField); return(compareFields.FirstOrDefault(c => sourceFieldName.Equals(GetFieldInfoFullName(c)))); } else { return(compareFields.FirstOrDefault(field => field.FieldType.FullName.Equals(sourceField.FieldType.FullName))); } }
public List <string> CompareTypes(Type source, Type compare) { var discrepancies = new List <string>(); if (TypeDeterminer.IsSimple(source)) // int, bool, string, { discrepancies.AddRange(CompareSimpleTypes(source, compare)); } else if (TypeDeterminer.IsGenericList(source)) { discrepancies.AddRange(CompareGenericList(source, compare)); } else { discrepancies.AddRange(CompareClasses(source, compare)); } return(discrepancies); }