I have 2 foreach loops, 1 nested inside the other. There are 115 total items in 2 collections. What I'm wanting to do is have the first item from the first collection written to the console and then the first item from the second collection written to the console. Go back to the first collection and do the second item and so on.
I understand why the nested loop is running over and over, I just can't figure out how to achieve what I want to achieve.
var Titles = chromeDriver.FindElements(By.CssSelector("div.contentItem__contentWrapper h1"));
var Text = chromeDriver.FindElements(By.CssSelector("div.contentItem__contentWrapper p"));
foreach (var title in Titles)
{
string t = title.Text;
Console.WriteLine($"Title: {t}");
foreach (var text in Text)
{
string p = text.Text;
Console.WriteLine($"Article Text: {p}");
}
}
Textin the innerforeach?There are 115 total items in 2 collections?