private void buttonCheck(object sender, EventArgs e)
{
Type x = sender.GetType();
var y = Activator.CreateInstance(x); //sends me back to the original problem : sender is an object, not a usable object.
var x = (Button)sender; // == button, but you never know what sender is until it's already in this function... so
dynamic z = sender; //gives you the image of sender i'm looking for, but it's at runtime, so no intellisense/actual compiletime knowledge of what sender is.
}
在没有事先知道类 sender 实际带入这个方法的情况下,你如何去创建一个可用的 sender 实例?