Posts

Showing posts from March, 2016

C# Currency Converter using Google API

C urrenc y conve rsion in C# u sing Googl e API There are so many ways to convert amount from one currency to another currency like using google finance converter, Yahoo finance and rate-exchange . In this post i will show conversion using   Google Finance Converter. In b elow code, I create one WebRequest for Google Finance Converter which will return result of arguments which are attached with it. Get the response of WebRequest in form of Stream and stored it in streamReader (which is the object of StreamReader Class) . By using, Regex fetched converted amount with desired currency code and stored this result into a string variable and again using Regex fetched only decimal part from generated string. Hope this post will help you to get the exact result that you want. public string CurrencyConvert(decimal amount, string fromCurrency, string toCurrency) { decimal currency = 0; string convertedAmount = "0"; try { string