Generate local variable suggestion

Hi!

Would be quite handy if Resharper could suggest generationg a variable when you call a method that returns a value without assigning the result to something.

For example, if you write:

foo.ToString()

it would suggest:

string sFoo = foo.ToString();

Regards,
Richard

2 comments
Comment actions Permalink

Richard,

In fact, "Introduce Variable" (CtrlAltV) does what you want. And you can
invoke it on incomplete statements.
Or am I missing something?

Friendly,
Dmitry

Hi!

Would be quite handy if Resharper could suggest generationg a variable
when you call a method that returns a value without assigning the
result to something.

For example, if you write:

foo.ToString()

it would suggest:

string sFoo = foo.ToString();

Regards,
Richard

--
Dmitry Lomov
Technical Lead/Software Architect
JetBrains, Inc.
"Develop With Pleasure!"


0
Comment actions Permalink

Thanks, thats pretty much what I was looking for! Still it would be helpful if that would be suggested automatically. For example writing:
Foo myFoo = new
suggests auto-completion for the line (= new Foo();).
Because it's obvious that foo.ToString(); is probably supposed to be assigned to something I think it'd be nice for it to suggest the variable creation. But Ctrl-alt-V is great! ;)

0

Please sign in to leave a comment.