【发布时间】:2009-08-08 03:49:10
【问题描述】:
我有这个sn-p
private void westButton_click(object sender, EventArgs ea)
{
PlayerCharacter.Go(Direction.West);
}
向北、南和东重复。
如何声明一个函数,让我以编程方式生成类似 ir 的方法?
例如,我想打电话
northButton.Click += GoMethod(Direction.North);
而不是定义方法,然后
northButton.Click += new EventHandler(northButton.Click);
【问题讨论】:
标签: c# first-class