I am a long year Java programmer, but currently I code in C#. I am accustomed, that when I change filename, also the class name changes and vice versa. This doesn't work in my Visual Studio. I must rename the class name and file name separately, and it's sometimes annoying for me, because I always forget on it, so it results to that I have different class and file names. Is there option in Visual Studio to put the renaming in one step?
Select Edit > Refactor > Rename. Right-click the code and select Rename.
First put your cursor on the member and click F2 . Then type the new name and hit the Enter key. This will rename all of the occurrences in every file in your project.
Renaming a file works fine - it'll offer to change the code to match:
If you rename the class, then - indeed, this doesn't happen by default. There is no actual need for the two to match, note. But ultimately, rename is only an f2 away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With