Block comment in C# keeps adding *
-
2010년 11월 21일 일요일 오전 3:37
When I use a block comment /* */ in C# every line is preceeded by an * which is fine when the comment is really a comment. However sometimes I need to comment out an entire block of code or a section and everytime I hit the enter key an * shows up. This is a problem because I have to remove all of them to re-activate the code and sometimes I miss one or two then the code doesn't compile and I have to edit the code again. It is distracting to my thought process, I lose my place and have to spend time going back over what I just did.
I have looked at customizing the editor and cannot find anything pertaining to comments for any language. Basically it is non-productive feature, if I had not wanted block comments I would be writing in VB. I spend more time reformatting my code than I do writing it and it is annoying as h$!!, can someone tell me why Microsoft is trying to make C# work like the worst of VB?
- 이동됨 Brittany Behrens [MSFT] 2010년 12월 9일 목요일 오전 12:43 (From:Visual Studio Editor)
모든 응답
-
2010년 11월 21일 일요일 오후 5:17
HI Pamela,
The editor works this way to make it easy to write comments. If your need is to comment out code (one or more lines), you simply comment them out using //. There is a very handy keyboard shortcut CTRL-K, CTRL-C.
This way you can easily remove parts of your code and later decide what to do with them.
Kind regards,
Tom de Koning
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".- 답변으로 제안됨 Tom de Koning 2010년 11월 21일 일요일 오후 5:17
- 답변으로 표시됨 Victor_Chen 2010년 11월 29일 월요일 오전 2:17
-
2010년 12월 9일 목요일 오전 9:44
hi Pamela,
slightly OT:
there is normally no reason to comment out an entire block of code. If you can do so, you have in most cases a block of code - an aspect or concern - which is worth being extract to its own method:
http://sourcemaking.com/refactoring/long-method
http://en.wikipedia.org/wiki/Separation_of_concernsAlso use a version control system like SVN, hg or TFS. Then you can simply delete the code for test purposes. And revert the changes afterwards.
Microsoft MVP Office Access
https://mvp.support.microsoft.com/profile/Stefan.Hoffmann -
2012년 8월 10일 금요일 오후 8:00
Am I the only one who recognizes this keystroke combination? CTRL-K, CTRL-C used to be block copy in Wordstar, back in the 80s. BTW, to uncomment, use CTRL-K, CTRL-U.
--Al--
- 답변으로 제안됨 ToolMan121 2012년 11월 30일 금요일 오후 9:05
- 답변으로 제안 취소됨 ToolMan121 2012년 11월 30일 금요일 오후 9:05
- 답변으로 제안됨 ToolMan121 2012년 11월 30일 금요일 오후 9:06
- 답변으로 제안 취소됨 ToolMan121 2012년 11월 30일 금요일 오후 9:06
-
2012년 8월 11일 토요일 오전 11:00
Where's the "I Like" when ones needed :)
-
2012년 11월 30일 금요일 오후 9:15Another set of keystroke combinations that performs the same block commenting is:
CTRL-E, C -- to comment out a block of code
CTRL-E, U -- to un-comment a block

