protected T Deserialize <T>(string s, string charset = null) where T : class { FormUrlEncodingSerializer serializer = new FormUrlEncodingSerializer(typeof(T)); s = s.Replace("\r", ""); s = s.Replace("\n", ""); using (TextReader reader = new StringReader(s)) { Encoding enc = (charset != null ? Encoding.GetEncoding(charset) : null); T data = (T)serializer.Deserialize(reader, new ObjectSerializerSettings { Encoding = enc }); return(data); } }
protected override object ReadFrom(TextReader reader, ReaderContext context) { FormUrlEncodingSerializer serializer = new FormUrlEncodingSerializer(context.DataType); return(serializer.Deserialize(reader, context.Session.SerializerSettings)); }