0

私はFormこれに似たコードを持つ を持っています:

public partial class Form1 : Form
{
    private int m_var1;
    private int m_var2;
    string sMsg;
    bool bReturn;

    private bool MyFunction()
    {
        // POINT A: at this point m_var1 and m_var2 are both 100            
        sMsg = "Test Message";
        bReturn = (DialogResult.Yes == MessageBox.Show(sMsg, "MyApp",MessageBoxButtons.YesNo, MessageBoxIcon.Question));
        // POINT B: at this point m_var1 and m_var2 are both 0
    }
}

私が経験しているように、なぜPOINT B持っているm_var1m_var2両方が変わった0のですか?

4

1 に答える 1

2

これはスレッドの問題のように聞こえます。この問題を解決する方法を説明できます。

  • m_var1 と m_var2 を Properties に変更します。
  • セッターにブレークポイントを設定します。

セッターにヒットしたコードのスタックトレースを確認してください。

于 2012-10-15T11:37:10.293 に答える