안녕 얘들 아, foreach에서 하나의 루프 ahain을 반복하는 방법.foreach에서 하나의 루프를 반복하는 방법
foreach (string line in File.ReadLines("file.txt"))
{
// now line == "account", next line == "account1"
if (line.Contains("a"))
//next loop take "account1";
else
// need to set that next loop will take line == "account" again
}
어떻게 할 수 있습니까?
당신은 할 수 없습니다 올 수있는 경우 추측; 대신'for '를 사용하십시오. – Nolonar
이 예제는 'account'라는 행을 반복해서 읽는 루프에서 멈추게됩니다 ...? –
이것은 XY 문제처럼 보입니다 - http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem. 코드에 대한 전반적인 의도를 설명 할 수 있습니까?이 샘플에는 결함이있는 것 같습니다. – Kami