C
Clinton Pierce
I can create a delegate like this, and everything works fine:
class Foo
{
private delegate void NextPanel();
private NextPanel myself;
// And later in a method
private void EffStart()
{
this.myself = new NextPanel(this.EffStart);
}
}
This program has lots of these self-referential delegates. What I'd like to
do is have a statement that simply says:
this.myself = new NextPanel(some reference back to the current running
method);
So I can avoid having to put the method name in the assignment (a source of
human errors, for sure). But I can't quite find the syntax. I've tried
most of:
this.myself = new
NextPanel(System.Reflection.MethodBase.GetCurrentMethod()....);
But can't find anything in there to give me the right type for the delegate
to make the compiler happy. Any recommendations?
class Foo
{
private delegate void NextPanel();
private NextPanel myself;
// And later in a method
private void EffStart()
{
this.myself = new NextPanel(this.EffStart);
}
}
This program has lots of these self-referential delegates. What I'd like to
do is have a statement that simply says:
this.myself = new NextPanel(some reference back to the current running
method);
So I can avoid having to put the method name in the assignment (a source of
human errors, for sure). But I can't quite find the syntax. I've tried
most of:
this.myself = new
NextPanel(System.Reflection.MethodBase.GetCurrentMethod()....);
But can't find anything in there to give me the right type for the delegate
to make the compiler happy. Any recommendations?