Sabeesh V4u

Sabeesh V4u

  • 1.4k
  • 763
  • 213.6k

How to loop two c# List parallelly

May 12 2022 1:51 PM

Hi,

I have two lists - list1  and  list2. i want to concatinate list 1 item + list 2 item and save to txt file.below code is not working how we can loop parellely?

foreach (string code in List1)
{
    for (int i = 0; i < List2.Count; i++)
    {
        if (code != "")
        {
            string total = code + ", " + "'" + List2[i] + "')";
            fullcode.Add(total);
        }
    }
}

 


Answers (6)