トップ回答者
「error CS0165: 未割り当てのローカル変数」と「Environment.Exit(-1);」

質問
-
C#をcsc.exeで勉強中です。こちらでいけなかったらご指摘ください。
お世話になります。よろしくお願いいたします。
以下のコードで「so_a = a; so_b = b;」の部分がないとコンパイルで「error CS0165: 未割り当てのローカル変数 'so_a'が使用されました。」となります。「Environment.Exit(-1);」の前でも後でもよいようになっています。「Environment.Exit(-1);」を終了コードとして認識していないのでしょうか。
using System;
using System.Windows.Forms;class main
{
static void Main()
{
string a = "ah";
string b = "yah";
string so_a, so_b;
Console.WriteLine("a: {0}\nb: {1}", a, b);
if ((a != null) || (b != null))
{
MessageBox.Show("Not null");
so_a = a; so_b = b;
}
else { MessageBox.Show("null"); Environment.Exit(-1); so_a = a; so_b = b; } // so_a = a; so_b = b;
Console.WriteLine("a: {0}\nb: {1}", a, b);
Console.WriteLine("so_a: {0}\nso_b: {1}", so_a, so_b);
Console.ReadKey();
}
}