// property deserialization defaults /// <summary> /// Returns true if the given property should be deserialized. /// /// Override to tweak behavior. /// </summary> protected virtual bool ShouldDeserialize(TypeInfo forType, PropertyInfo property) { if (property.SetMethod == null) { return(false); } var ignoreDataMember = property.GetCustomAttribute <IgnoreDataMemberAttribute>(); if (ignoreDataMember != null) { return(false); } var dataMember = property.GetCustomAttribute <DataMemberAttribute>(); if (dataMember != null) { return(true); } return (property.SetMethod != null && property.SetMethod.IsPublic && !property.SetMethod.IsStatic && property.SetMethod.GetParameters().Length == 1 && DeserializableMember.GetDefaultParser(property.SetMethod.GetParameters()[0].ParameterType.GetTypeInfo()) != null); }
/// <summary> /// Returns the default cell parsing method for the given type, if any. /// /// Override to tweak behavior. /// </summary> protected virtual MethodInfo GetCellParsingMethodFor(int columnNumber, string columName, TypeInfo targetType) => DeserializableMember.GetDefaultParser(targetType);
private static MethodInfo GetParser(TypeInfo forType) => DeserializableMember.GetDefaultParser(forType);