Example #1
0
 /// <summary>
 /// Read the serialized data from the reader and return the
 /// deserialized object.
 /// </summary>
 /// <param name="reader">TextReader to read the data from</param>
 /// <returns>the deserialized object</returns>
 public object Deserialize(TextReader reader)
 {
     if (reader == null)
         throw new ArgumentNullException("reader");
     Parser p = new Parser(_serializedType, reader, _context);
     return p.Parse();
 }
 protected virtual Expression Parse(TextReader reader)
 {
     if (reader == null)
         throw new ArgumentNullException("reader");
     Parser p = new Parser(reader, this.Config.TypeAliases);
     Expression parsedExpression = p.Parse();
     parsedExpression.ResultType = this.SerializedType;
     foreach (IParsingStage stage in this.Config.ParsingStages)
     {
         parsedExpression = stage.Execute(parsedExpression);
     }
     return parsedExpression;
 }