Reputation: 11635
I commented on this answer some time ago regarding how visual studio comments out code with //
or /* */
. I was thinking to revise the answer (to include my findings) but I had to test it first, which kind of confused me.
My finding is that depending on what you comment when you press Ctrl - K, Ctrl - C you will get either //
or /* */
.
<start selection here> code();
someCall();
thirdCall();<end selection here>
this will produce the following:
//code();
//someCall();
//thirdCall();
<start selection here>code();
someCall();
thirdCall();<end selection here>
this will produce the following:
/*code();
someCall();
thirdCall();*/
<start selection here>code();
//someCall();
thirdCall();<end selection here>
this will produce the following:
//code();
////someCall();
//thirdCall();
Note that example 2 and 3 is the exact same selection, but the comment makes Visual Studio interpret it differently.
Why is this?
Upvotes: 2
Views: 2261
Reputation: 57892
The approach one would expect is to use // for any selection that is made up entirely of complete lines, and /*...*/ for anything that starts/ends mid-way along a line.
...which is what it seems to actually do.
Upvotes: 2