venkat

venkat

  • NA
  • 138
  • 52.1k

how to make make fast my code in c#

Sep 7 2017 8:20 AM
Hi All,
 
i am uploading one excel file . file contains 5k Records .
it is taking around 29 minutes. how to make a fast .could please any one help?
below is my code. 
Parallel.For(0, requests.Count, new ParallelOptions { MaxDegreeOfParallelism = 10 }, i =>
{
string s = requests[i].LdcName;
try
{
Utility utility = GetUtilities(client).FirstOrDefault(x => x.DEAbbreviation == requests[i].LdcName);
requests[i].LdcName = utility != null ? utility.Abbreviation : s;
client.PutUsageRequest(requests[i]);
statuses.Add(MapRequestToStatus(requests[i], true, SUCCESS_STATUS, i + 2));
}
catch (Exception ex)
{
//Report to the UI the provided ldc name
requests[i].LdcName = s;
statuses.Add(MapRequestToStatus(requests[i], false, ex.Message, i + 2));
}
});
 

Answers (4)