我在 toPickedImage 方法中收到空引用错误,我不明白为什么会这样。任何人都可以帮助我解释为什么我会收到此错误。
任何和所有的帮助将不胜感激!
代码如下:
public partial class ownGUI : UserControl
{
private string m_id;
private int m_value;
public event EventHandler<GameEventArgs> Pickedimage;
public ownGUI()
{
InitializeComponent();
}
public ownGUI(String id, int value)
{
InitializeComponent();
m_id = id;
m_value = value;
GameEventArgs image = new GameEventArgs(m_id, m_value);
toPickedimage(image);
}
public void toPickedimage(GameEventArgs e)
{
if (Pickedimage != null)
{
Pickedimage(this, e);
}
}
}
//问候