Prima
this.Invoke(
delegate { this.Text = "x"; }
);
Nu funcționează.Veți primi eroarea "Cannot convert anonymous method to type 'System.Delegate' because it is not a delegate type"
Însă
this.Invoke(
(MethodInvoker) delegate { this.Text = "x"; }
);
Funcționează..Văzut aici
A doua
public event EventHandler Updated = delegate { };
Acest mod de declarare a evenimentelor te scapă te testul Updated == null. Mai e și trhread safe pe deasupra.Văzut aici.
Fii primul care dă o notă acestei însemnări
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5