When writting codes, if we typed a undefined references, pressing Ctrl+. will bring up the generating-code list box which says generate field/property/method. I'm looking for a way to generate a local variable but I don't know how to.
To make it more clearer, I'll give an example. Say we have a method
void MyMethod(MyType param)
{
//do something
}
Then in another method of the same class I write:
MyMethod(undefinedObject);
I wish to be able to generate the below codes automatically (of course through Ctrl+. when placing the cursor under 'undefinedObject'):
var undefinedObject = new MyType();
MyMethod(undefinedObject);
Hope you have some work-around for me. Thanks!
[Edit] At the moment, I use the generated field. Then cut the line declaring the field and paste it on the line where it should be in my code. This routine is time-consuming and quite boring. So I ask here to look for a better way/addon to do that. Prefer a free tool, not Resharper I hope.