A
Andrew Robinson
Is there any general purpose delegate that will allow me to call a method
anonymously. The delegate does not pass any data as part of the method
signature and has a void return. Data is passed as part of the method body.
I am thinking something along the line of Action<null>. Just wondering if
there is a simpler method other than declaring the delegate FredDelegate()?
example:
private delegate void FredDelegate();
private void Fred(FredDelegate action)
{
// code here
action();
// more clode here
}
public void Fred()
{
Fred(delegate() { });
}
public void Fred(FredKey key)
{
Fred(delegate() { this.status = key.status; });
}
anonymously. The delegate does not pass any data as part of the method
signature and has a void return. Data is passed as part of the method body.
I am thinking something along the line of Action<null>. Just wondering if
there is a simpler method other than declaring the delegate FredDelegate()?
example:
private delegate void FredDelegate();
private void Fred(FredDelegate action)
{
// code here
action();
// more clode here
}
public void Fred()
{
Fred(delegate() { });
}
public void Fred(FredKey key)
{
Fred(delegate() { this.status = key.status; });
}