public override void Serialize(object obj, Stream s, BaseSerializerOptions opt) { if (opt is TextSerializerOptions options) { } else { } }
static void Test(BaseSerializerOptions o) { var obj = new Object(); using (var fs = File.Open("...", FileMode.Create)) { var r1 = Serializer.Write(obj, fs, o); CheckSerializerResults(r1); } }
public static SerializerResult Write(Object obj, Stream s, BaseSerializerOptions opt) { switch (opt) { case TextSerializerOptions o: return(WriteText(obj, s, o)); case BinarySerializerOptions o: return(WriteBinary(obj, s, o)); } throw new Exception(); }