C#: Am i validating filetype and using goto in a right manner?
<p>i have code to save a file like</p>

<pre><code>SaveFileDialog dialog = new SaveFileDialog();
dialog.Filter = "Text files|*.txt";

SaveDialog:
if ((bool)dialog.ShowDialog()) {
    if (System.IO.Path.GetExtension(dialog.FileName) != ".txt") {
        MessageBox.Show("You must select a .txt file");
        dialog.FileName = "";
        goto SaveDialog;
    }
    File.WriteAllText(dialog.FileName, txtEditor.Text);
}
</code></pre>

<p>i read that i should not use goto. i could use do/while and check that a valid extension was selected but that will add alot of unnecessary code. i find this neater. or is there a better/more correct way?</p>
