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);
     }
 }
예제 #3
0
파일: program.cs 프로젝트: csdahlberg/bond
        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);
        }