S
Stefan Hoffmann
hi @all,
is there something like an anonymous delegate?
This is the original code:
--
private delegate void DelegateSetFormCaption(string text);
private void SetFormCaption(string text)
{
if (this.InvokeRequired)
{
DelegateSetFormCaption d = new
DelegateSetFormCaption(SetFormCaption);
this.Invoke(d, new object[] { text });
}
else { this.Text = text; }
}
--
I'd like to avoid the delegate declaration, e.g.:
--
private void SetFormCaption(string text)
{
if (this.InvokeRequired)
{
this.Invoke(
new delegate(string text)(SetFormCaption), new object[] { text }
);
}
else { this.Text = text; }
}
--
Is this possible?
mfG
--> stefan <--
is there something like an anonymous delegate?
This is the original code:
--
private delegate void DelegateSetFormCaption(string text);
private void SetFormCaption(string text)
{
if (this.InvokeRequired)
{
DelegateSetFormCaption d = new
DelegateSetFormCaption(SetFormCaption);
this.Invoke(d, new object[] { text });
}
else { this.Text = text; }
}
--
I'd like to avoid the delegate declaration, e.g.:
--
private void SetFormCaption(string text)
{
if (this.InvokeRequired)
{
this.Invoke(
new delegate(string text)(SetFormCaption), new object[] { text }
);
}
else { this.Text = text; }
}
--
Is this possible?
mfG
--> stefan <--