如何将多个字符串值传递给 C# 中的按钮单击事件处理程序?
最佳答案
如果你事先知道字符串,你可以使用匿名函数来捕获和传递字符串
string s1 = ...;
string s2 = ...;
button.Click += (sender, e) => { MyHandler(sender, e, s1, s2); };
void MyHandler(object sender, EventArgs e, string s1, string s2) {
...
}
关于c# - 如何将多个字符串值传递给 C# 中的按钮单击事件处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5395908/