public override object Deserialize(Stream inputStream)
 {
     Initialize();
     inputStream.Seek(0, SeekOrigin.Begin);
     var reader = new SimpleJsonReader(inputStream);
     return _deserializer.Deserialize(reader);
 }
 public override object Deserialize(string serialized)
 {
     Initialize();
     using (var tr = new StringReader(serialized))
     {
         var reader = new SimpleJsonReader(tr);
         return _deserializer.Deserialize(reader);
     }
 }
Ejemplo n.º 3
0
        static void Main()
        {
            var config = new Config
            {
                Variant = "Simple",
                Enabled = true,
                Urls = { "http://example.com", "http://www.example.com" }
            };

            var jsonString = new StringBuilder();
            var jsonWriter = new SimpleJsonWriter(new StringWriter(jsonString));

            Serialize.To(jsonWriter, config);
            jsonWriter.Flush();
            Console.WriteLine(jsonString);

            var reader = new SimpleJsonReader(new StringReader(jsonString.ToString()));
            config = Deserialize<Config>.From(reader);
        }