[221] [VS2005] Extract variable within switch
Hi,
I tried extracting variables from string literals in a switch statement,
but R# puts the extracted string within the switch statement instead of
above:
switch(type){
case "Numeric":
break;
case "MultipleChoice":
break;
}
now extract a variable from "Numeric", R# turns it into this:
switch(type){
private const string Numeric="Numeric";
case Numeric:
break;
case "MultipleChoice":
break;
}
Regards,
Wiebe
Please sign in to leave a comment.
Additionally (ok this is a little trivial), since it's in within a case
label, only constants are allowed so it would be nice if the 'const'
checkbox is automatically checked. :)
For me it would be nice anyway to have 'const' checked by default if a
string literal is extracted to a variable...
Thanks!
Wiebe Tijsma wrote:
Hello Wiebe,
Thanks for reporting the bug. Could you also please submit it to the bugtracker
(www.intellij.net/tracker/resharper/browse) to be notified when it's fixed?
Oleg Stepanov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
>> Hi,
>>
>> I tried extracting variables from string literals in a switch
>> statement, but R# puts the extracted string within the switch
>> statement instead of above:
>>
>> switch(type){
>> case "Numeric":
>> break;
>> case "MultipleChoice":
>> break;
>> }
>> now extract a variable from "Numeric", R# turns it into this:
>>
>> switch(type){
>> private const string Numeric="Numeric";
>> case Numeric:
>> break;
>> case "MultipleChoice":
>> break;
>> }
>> Regards,
>>
>> Wiebe
>>
Hi Oleg,
Thanks, done added #19888
(http://www.intellij.net/forums/thread.jsp?forum=35&thread=204235)
Wiebe
Oleg Stepanov (JetBrains) wrote:
>> Additionally (ok this is a little trivial), since it's in within a
>> case label, only constants are allowed so it would be nice if the
>> 'const' checkbox is automatically checked. :)
>>
>> For me it would be nice anyway to have 'const' checked by default if a
>> string literal is extracted to a variable...
>>
>> Thanks!
>>
>> Wiebe Tijsma wrote:
>>
>>> Hi,
>>>
>>> I tried extracting variables from string literals in a switch
>>> statement, but R# puts the extracted string within the switch
>>> statement instead of above:
>>>
>>> switch(type){
>>> case "Numeric":
>>> break;
>>> case "MultipleChoice":
>>> break;
>>> }
>>> now extract a variable from "Numeric", R# turns it into this:
>>>
>>> switch(type){
>>> private const string Numeric="Numeric";
>>> case Numeric:
>>> break;
>>> case "MultipleChoice":
>>> break;
>>> }
>>> Regards,
>>>
>>> Wiebe
>>>