Get USD to INR exchange rate dynamically in C#?

前端 未结 3 472
我在风中等你
我在风中等你 2021-01-07 08:03

\"enter

I\'m developing a Windows application to convert USD to INR. I know how to con

3条回答
  •  一生所求
    2021-01-07 08:24

    Here is the code piece: Add System.IO and System.Net and System.Xml

    WebRequest webrequest =WebRequest.Create("http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&ToCurrency=INR");
            HttpWebResponse response = (HttpWebResponse)webrequest.GetResponse();
            Stream dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);
            string responseFromServer = reader.ReadToEnd();
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(responseFromServer);
            string value = doc.InnerText;
            MessageBox.Show(value);
            reader.Close();
            dataStream.Close();
            response.Close();
    

提交回复
热议问题