public string TextValue { set { if (this.Memo.Invokerequired) { this.Invoke((MethodInvoker)delegate { this.Memo.Text += value + "\n"; }); } else { this.Memo.Text += value + "\n"; } } }
如何添加多个参数以及如何使用它们(值,值)?
简单地做一个方法而不是属性:
public void DoSomething(string foo,int bar) { if (this.Invokerequired) { this.Invoke((MethodInvoker)delegate { DoSomething(foo,bar); }); return; } // do something with foo and bar this.Text = foo; Console.WriteLine(bar); }