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>
            <Description>Code snippet for multiline C# comments</Description>
            <Author>Carlo Folini</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>name</ID>
                    <ToolTip>Multiline C# comment</ToolTip>
                    <Default></Default>
                </Literal>
            </Declarations>
            <Code Language="csharp"><![CDATA[/*$selected$*/]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

Following this post, I put this snippet under My Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets.

Didn't find a way to strip the comments tags, anyway

that's it

posted @ sabato 1 dicembre 2007 01:01

Print
Comments have been closed on this topic.
«novembre»
domlunmarmergiovensab
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567