using System; namespace QFSW.QC { /// /// Serializer for a single type. /// /// The type to serialize. public abstract class BasicQcSerializer : IQcSerializer { private Func _recursiveSerializer; public virtual int Priority => 0; public bool CanSerialize(Type type) { return type == typeof(T); } string IQcSerializer.SerializeFormatted(object value, QuantumTheme theme, Func recursiveSerializer) { _recursiveSerializer = recursiveSerializer; return SerializeFormatted((T)value, theme); } protected string SerializeRecursive(object value, QuantumTheme theme) { return _recursiveSerializer(value, theme); } public abstract string SerializeFormatted(T value, QuantumTheme theme); } }