I have some code in C#, I am not very good in C# so used loops inside loops but they are taking too long. Is there any way to write code for very fast execution to save time with accuracy?
Here is the code.
foreach (var vmain in vendorMainResult)
{
foreach (var povendor in potoDateOrders)
{
if (vmain.VendorNumber == povendor.VendorNumber && vmain.Year == povendor.Year)
{
vmain.ToDateOrders = povendor.ToDateOrders;
vmain.OutstandingComm = povendor.OutstandingComm;
break;
}
}
}
Think about if there are 20,000 records in each collection then 20k x 20k takes 1-2 minute.