IMarshalSerializer.cs 699 B

123456789101112131415161718192021
  1. using System.IO;
  2. namespace TBL.CSharp.Serialization.Marshal
  3. {
  4. /// <summary>
  5. /// Marshal 风格的序列化器
  6. /// </summary>
  7. public interface IMarshalSerializer
  8. {
  9. /// <summary>
  10. /// 使用指定上下文序列化对象
  11. /// </summary>
  12. public void Serialize(object self, Stream stream, IMarshalContext context);
  13. /// <summary>
  14. /// 使用指定上下文和指定目标对象进行反序列化
  15. /// <para>如果序列化结果如不匹配,将不会对目标对象进行操作</para>
  16. /// </summary>
  17. public object Deserialize(Stream stream, IMarshalContext context, object target);
  18. }
  19. }