Basically, you don't - The way I would do it is to just use the one loop:
foreach (var line in txtText.Lines.Skip(1))
{
if (line.Contains("Method"))
{
ingredients.Value = ingredientsText;
ingredientsText = "";
}
ingredientsText += string.Format("<p>{0}</p>\n", line);
}
method.Value = ingredientsText;
But...you shouldn't use a string for that, it's very inefficient. Use a StringBuilder instead:
StringBuilder text = new StringBuilder();
foreach (var line in txtText.Lines.Skip(1))
{
if (line.Contains("Method"))
{
ingredients.Value = text.ToString();
text.Clear();
}
text.AppendFormat("<p>{0}</p>\n", line);
}
method.Value = text.ToString(); ;
[edit] :doh: Left the "break"s in from the OP example :O - OriginalGriff[/edit]