Class ExchangeRate {Private Const string _baseurl = "web address"; public Const string currencycode = "currency type with ' | ' "//currency type Public Hashtable GetValues () {Hashtable Htreturn = new Hashtable (); string url = _baseurl;//+ httputility.url Encode (tmset.tostring ("Yyyy/mm/dd", Datetimeformatinfo.invariantinfo)); WebClient WC = new WebClient (); String sHtml = WC. downloadstring (URL); String sXml = String. Empty; int ivaluecnt = CurrencyCode. Split (new char[] {' | '}, ten, stringsplitoptions.removeemptyentries). Length; string[] Stbody = Shtml.split (new string[] {"<tbody>", "</tbody>"}, Stringsplitoptions.removeemptyentries ); foreach (String ss in Stbody) {if (ss. Contains ("Currency Name")) {string[] SBRs = ss. Split (new string[] {"</tr>"}, Stringsplitoptions.removeemptyentries); foreach (String sbr in SBRs) {string scur = string. Empty; Double drate = getcurrencyrate (SBR, out scur); if (drate! = 0.0 &&!string. IsNullOrEmpty (scur)) {Htreturn.add (scur, drate * 0.01); if (HtretuRn. Count >= ivaluecnt) break; }} break; }} return Htreturn; } private double Getcurrencyrate (string source, out string scurrency) {scurrency = string. Empty; String spattern = @ "<td.+?> (. +?) </td> "; foreach (Match m in regex.matches (source, Spattern)) {string ss = M.groups[1]. Value; if (IsNumeric (SS)) return double. Parse (ss); else {if (currencycode. Contains (ss)) Scurrency = ss. Trim (); else break; }} return 0.0; public static bool IsNumeric (String str) {if (string. IsNullOrEmpty (str)) return false; System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex (@ "^[-]?\d+[.|,]?\d*$"); Return Reg. IsMatch (str); } }