在我的項目中,我看到我有兩個構造函數。調試器只附加到第二個構造函數 - 爲什麼我有兩個?爲什麼我的課堂上都有這兩個構造函數?
public EventDialog()
{
// Required for Windows Form Designer support
InitializeComponent();
m_timer.Interval = SystemInformation.DoubleClickTime;
m_timer.AutoReset = false;
m_timer.Elapsed +=new System.Timers.ElapsedEventHandler(TimerElapseCallback);
} // Constructor
public EventDialog(string[] list)
{
// Required for Windows Form Designer support
InitializeComponent();
if(list != null)
{
foreach(string s in list)
{
if(s.Trim() != string.Empty)
m_leafComboBox.Items.Add(s.Trim());
}
}
m_timer.Interval = SystemInformation.DoubleClickTime;
m_timer.AutoReset = false;
m_timer.Elapsed +=new System.Timers.ElapsedEventHandler(TimerElapseCallback);
}
你的問題是什麼? – Gabe 2011-03-24 04:18:06
然後在代碼中調用第二個構造函數 - 也就是找到代碼實際上構造了一個EventDialog,它將使用第二個調試器進入該調試器的代碼。如下所述,VS設計人員需要默認(無參數)構造函數。 – 2011-03-24 04:34:53
您的聲明「調試器僅通過第二個構造函數進行連接」尚不清楚。不確定你指的是什麼。你得到什麼錯誤? – 2011-03-24 04:58:15