I had a problem with the code not being able to refactor, and the only option that was brought up was “Invert If”, and not “Extract Method”. It would only try to fix the code I had, and not put it into a separate function of its own.
I found an easy fix to bypass this “only option” by…
- Highlighting the code you want to refactor
- Going up top into the “Edit” tab
- While inside Edit, going almost all the way down to the option saying “Refactor”
- Select the “Extract Method” option.
I encountered a big problem by doing this, though. I was greeted with a warning that I probably shouldn’t attempt the Extract Method option. I went through anyways, and it did everything it was supposed to, like in the video. The problem arose after I selected “Yes” to the warning. I wasn’t able to type anything or edit text in any way. All I did was save the file, quit out of Visual Studio, and voila! I’m able to edit the code again.
I’m not able to provide any screenshots, as clicking out of the Visual Studio window will result in just showing the code window. Hope I could still help, however!