Reporter | Alexander Groß (alexandergross) |
---|---|
Created | Jun 10, 2011 12:52:28 PM |
Updated | Mar 27, 2012 5:03:10 PM |
Priority | Critical |
Type | Bug |
Fix versions | 7.0 |
State | Submitted |
Assignee | Alexey Kuptsov (alexey.kuptsov) |
Subsystem | Quick Fixes |
Affected versions | 5.1.3 |
Fixed in build | No Fixed in build |
I know that you have to review refactorings after applying them, but do you see an option of not suggesting if->switch when it alters semantics?
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var i = 3; for (var j = 0; j < i; j++) { if (Something() == TheEnum.Foo) // Convert if to switch { Another(); break; } else { break; } } } static void Another() { Console.WriteLine("Another"); } static TheEnum Something() { Console.WriteLine("Something"); return TheEnum.Bar; } } internal enum TheEnum { Foo, Bar } }