A serialized factory provider, support a variety of serialization.
Package | NuGet |
---|---|
Es.Serializer | |
Es.Serializer.Jil | |
Es.Serializer.JsonNet | |
Es.Serializer.NetSerializer | |
Es.Serializer.ProtoBuf |
StringWriter sw = new StringWriter();
SerializerFactory.Default.Serialize(obj,sw);
StringReader sr = new StringReader(sw.ToString());
var foo = bs.Deserialize(sr, typeof(Foo));
Stream output = new MemoryStream();
SerializerFactory.Default.Serialize(obj,outbut);
output.Position = 0;
var foo = bs.Deserialize(output, typeof(Foo));
var output = SerializerFactory.Default.SerializeToString(obj,outbut);
var foo = bs.DeserializeFromString<Foo>(output);
SerializerFactory.AddSerializer(new JilSerializer(), "jil");
SerializerFactory.AddSerializer(new JsonNetSerializer(), new string[] { "jsonNet", "json" });
SerializerFactory.AddSerializer<NETSerializer>("NET");
--Set Default
SerializerFactory.SetDefault(new JilSerializer());