I am having an array of ids like this
[
"b1a9564e-4e99-41aa-9268-c620ccb0ea9f",
"5d963ccf-a5da-4ac8-9c32-95e828db072d",
"1cdbd1bd-6f32-44a2-9571-d5c1282e203e",
"020d6d09-1971-42ab-a52d-d108e2d04515",
"f2c4fe0c-70ff-43c1-b8c1-411f50a1fc5e",
"e8d34d93-864a-4625-93bb-8cddf9970303",
"f0eeceaf-f0f0-48d6-afc4-14bfb41edef0",
"67eed6b0-aee4-407c-ab40-d7356a153176"
.
.
.
.
]
This is my method which takes List of ids as a parameter and calls API for each id in list
public async Task<List<string>> GetListFHALoanDetails(List<string> loanGuids)
{
List<LoanFHADetails> loanFHADetails = new List<LoanFHADetails>();
List<string> loanDetails = new List<string>();
for (int i = 0; i < loanGuids.Count; i++)
{
LoanFHADetails tempDetails = new LoanFHADetails();
tempDetails = await GetFHALoanDetails(loanGuids[I]); // Calling API Here
if (tempDetails != null)
{
loanDetails.Add(JsonConvert.SerializeObject(tempDetails));
}
}
return loanDetails;
}
The problem in the list may have many ids nearly 20k loans it taking so much time process the entire list. How to speed up the process?