Feature Request: convert anonymous method to local variable, or named method

Hi,

I'd like to be able to convert/extract/introduce (whatever you want to call
it) anonymous method declarations to named methods, or local variables.

For example, given:

button.Click += delegate { return; };

I'd like to be able to convert it to a named method:

void Handler(object sender, EventArgs e)
{
return;
}

...

button.Click += Handler;

Or a local variable:

EventHandler handler = delegate { return; };
button.Click += handler;

Thanks

---
Richard



1 comment
Comment actions Permalink

Agreed! I've seen some anonymous methods get ridiculous in size and I have
to end up scrolling the screen to the right to see the entire contents.

A ReSharper refactoring for this craziness would be appreciated! :)

Cheers,
-Paul

Hi,

I'd like to be able to convert/extract/introduce (whatever you want to
call it) anonymous method declarations to named methods, or local
variables.

For example, given:

button.Click += delegate { return; };

I'd like to be able to convert it to a named method:

void Handler(object sender, EventArgs e)
{
return;
}
...

button.Click += Handler;

Or a local variable:

EventHandler handler = delegate { return; };
button.Click += handler;
Thanks

---
Richard



0

Please sign in to leave a comment.