Ejemplo n.º 1
0
        public EventArgs Read(Stream innerStream, Type concreteType)
        {
            if (innerStream == null) throw new ArgumentNullException("innerStream");
            if (concreteType == null) throw new ArgumentNullException("concreteType");

            using (var sr = new StreamReader(innerStream.PreventClosure(), Encoding.UTF8, false, 128))
            using (var jtr = new JsonTextReader(sr)) {
                SetupJsonTextReader(jtr);
                return
                    (EventArgs)
                    new JsonSerializer { TypeNameHandling = TypeNameHandling.Auto }
                        .Deserialize(jtr, concreteType);
            }
        }