public override Task <object> ReadFromStreamAsync(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger) { if (type == null) { throw new ArgumentNullException("type"); } if (readStream == null) { throw new ArgumentNullException("readStream"); } try { return(Task.FromResult(ReadFromStream(type, readStream, content, formatterLogger))); } catch (Exception e) { return(TaskResults.FromError <object>(e)); } }
public override Task WriteToStreamAsync(Type type, object value, Stream writeStream, HttpContent content, TransportContext transportContext) { if (type == null) { throw new ArgumentNullException("type"); } if (writeStream == null) { throw new ArgumentNullException("writeStream"); } try { WriteToStream(type, value, writeStream, content); return(TaskResults.Completed()); } catch (Exception e) { return(TaskResults.FromError(e)); } }