dicembre 2007 Blog Posts

Macros for multiline comments in Visual Studio

In my previous post I tried using code snippet to handle multiline comments insertion, but I didn't achieve removing those comments. What I want to achieve is something like the default behavior for xml files when using the comment and uncomment buttons. Using macros I can get it! So one macro to put comment (modified from the sample macro in vs) and one to uncomment. The first surround the start and end selection with comment markers (for c# /* */). The second takes the caret position and strips the previous start comment marker (/*) and the...

Code snippet for multiline comments in Visual Studio

Sometime you want to comment multiple line of c# code. Visual studio uses // for each line of code if you use the comment/uncomment button. I wanted to use the multiline comments /* */. With the following snippet you can do this by using "Surround with" <?xml version="1.0" encoding="utf-8" ?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>Multiline C# comment</Title> <Shortcut>comment</Shortcut> ...