コード例 #1
0
        public async Task <IReadOnlyCollection <CurrencyRate> > GetCurrencyRatesToDate(DateTime date,
                                                                                       CancellationToken cancellationToken = default)
        {
            var result = await CallWithCancellation(SoapClient.GetCursOnDateXMLAsync(date), cancellationToken);

            XmlDocument xmlDocument = new XmlDocument();
            var         root        = xmlDocument.CreateElement("root");

            root.InnerXml = result.InnerXml;
            xmlDocument.AppendChild(root);

            var response = Deserialize <GetCursOnDateResponse>(xmlDocument);

            foreach (var rate in response.Rates)
            {
                rate.Name = rate.Name.Trim();
            }

            return(response.Rates);
        }