private static void WriteXmlDataProperties(XmlWriter writer, object obj, Type type) { writer.WriteAttributeString(_XTYPE_, _DATABASE_); writer.WriteAttributeString(_TYPE_, SerializableTypeName(type)); var properties = XConfig.Select_XmlSerializableProperties(type); foreach (var property in properties) { object value = property.GetValue(obj); if (value == null) { continue; } if (property.GetCustomAttribute(typeof(DefaultValueAttribute)) is DefaultValueAttribute defValueAttr) { if (defValueAttr.Value?.Equals(value) ?? false) { continue; } } string key = property.Name; writer.WriteStartElement(_ENTRY_); writer.WriteAttributeString(_KEY_, key); WriteObjectToXmlWriterRecursive(writer, value); writer.WriteEndElement(); } }