class Plane
{
public event EventHandler Land;
protected void OnLand()
{
if (null != Land)
{
Land(this, null);
}
}
}
它是事件處理程序做,而不是最好的做法:事件處理程序在C#語言
EventHandler temp = Land;
if (null != temp)
{
temp(this, null);
}
那是真的有必要嗎?在什麼情況下,土地的溫度可能會不同?
我看不到您訂閱活動的位置。如果您要嘗試更新用戶界面,您可能還需要檢查是否需要調用。 –