C# Wait for part of while loop to finish to execute another action
<p>I'm trying to convert one value to another. I am importing a text file, using streamreader/writer. I want to know if I can have the part of the while loop inside the if statement wait until the the rest of the loop finishes before writing what its supposed to. I know this is probably an easy question but for some reason I can put my finger on it. I am not using multithread processing and want to stay away from asynch.</p>

<pre><code>using (StreamReader reader = new StreamReader(convertInput))
{
    string line;
    writer.WriteLine(formatter, "Original Value", "Converted Value");
    writer.WriteLine(formatter, "--------------", "---------------");
A:  while ((line = reader.ReadLine()) != null)
    {
            string str2BeConverted = line;
            long numHexToDex;
            if ((Int64.TryParse(line, NumberStyles.HexNumber, null, out numHexToDec)) == false)
            {
                    writer.WriteLine();
                    writer.Write(line + " " + "is not a Hexadecimal value.");
                    goto A;
            }

            Int64.TryParse(line, NumberStyles.HexNumber, null, out numHexToDec);
            string lineChanged = numHexToDec.ToString("G");
    }
}
</code></pre>

<p>I am wanting to wait until all the values that parse successfully are written, then write the ones that didn't at the end. </p>
