public string GetFormulasStringRepresentation(string value) { var response = new Response(); RequestWrapper request; List <string> errors; using (Stream stream = new MemoryStream()) { var writer = new StreamWriter(stream); writer.Write(value); writer.Flush(); stream.Position = 0; request = WrapperFactory.CreateRequestWrapper(stream, out errors); } response.Result = request?.StringForm ?? ""; response.Errors = errors.ToArray(); var xsSubmit = new XmlSerializer(typeof(Response)); using (var sww = new StringWriter()) { using (var writer = XmlWriter.Create(sww)) { xsSubmit.Serialize(writer, response); return(sww.ToString()); } } }