RightC Interview Question for Software Trainees
- 0of 0 votes
Answerneeded to turn a sequential Actions into parallel implementation
static string FlNm = Environment.CurrentDirectory, URL = "", TmpHtm = ""; enum Act { dolar, ValidateTimeOut } void Execute(Act Exc) { switch (Exc) { case Act.dolar: URL = "http://www.boi.org.il/he/Markets/ForeignCurrencyMarket/Pages/Default.aspx"; FlNm += "\\TempHtm.htm"; TmpHtm = AgilityPacDocExtraction(URL).GetElementbyId("Dv_Main").InnerHtml; File.WriteAllText(FlNm, TmpHtm); break; case Act.ValidateTimeOut: URL = "http://hm.hental.co.il/timeclock/tcreportall/WorkDaysPerMonth.aspx?Cstate=Link"; FlNm += "\\TempHtm.htm"; TmpHtm = AgilityPacDocExtraction(URL).GetElementbyId("anyId").InnerHtml; File.WriteAllText(FlNm, TmpHtm); break; } } public HtmlAgilityPack.HtmlDocument AgilityPacDocExtraction(string URL) { using (WC = new WebClient()) { WC.Proxy = null; WC.Encoding = Encoding.GetEncoding("UTF-8"); tmpExtractedPageValue = WC.DownloadString(URL); retAglPacHtmDoc.LoadHtml(tmpExtractedPageValue); return retAglPacHtmDoc; }
}
- rbanay2 November 22, 2012 in israel for C#| Report Duplicate | Flag | PURGE
RightC Software Trainee C#
Country: israel
tried out with kinda smart solution , iterating on each enum value , then execute same method different parameters ,
but as i am still fresh with TPL i could not yet solve issue with WC through multiple request parllely
- rbanay2 November 22, 2012