Exemplo n.º 1
0
        /// <summary>
        /// Decodes the specified source.
        /// </summary>
        /// <typeparam name="T">The type of the object to decode.</typeparam>
        /// <param name="source">The source.</param>
        /// <returns>The decoded object.</returns>
        public static T Decode <T>(string source)
            where T : IEncodable <T>, new()
        {
            var encodable = new T();
            var decoder   = new JsonDecoder(source);

            return(encodable.Decode(decoder));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Context"/> class.
 /// </summary>
 /// <param name="parentDecoder">The parent decoder.</param>
 public Context(JsonDecoder parentDecoder)
 {
     this.parent = parentDecoder;
 }