Exemplo n.º 1
0
        public T Instantiate([NotNull] MercuryResponse resp)
        {
            var serializer = new JsonSerializer();

            using var sr             = new StreamReader(new MemoryStream(Combine(resp.Payload.ToArray())));
            using var jsonTextReader = new JsonTextReader(sr);
            return(typeof(T) == typeof(string)
                ? (T)(object)sr.ReadToEnd()
                : serializer.Deserialize <T>(jsonTextReader));
        }
 public T Instantiate(MercuryResponse read) => _parser.ParseFrom(Combine(read.Payload.ToArray()));