Tuesday, October 11, 2011

Sample CodeSnippet for C++ in VisualStudio

To enable code snippets in VisualStudio 2005, you need to install Microsoft Visual Studio 2005 IDE Enhancements

You can write your code snippets however you want, see the below example for 'for' code snippet:
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
            <Description>Code snippet for 'for' loop</Description>
            <Author>Microsoft Corporation</Author>
                    <ToolTip>Max length</ToolTip>
            <Code Language="cpp"><![CDATA[for (int $index$ = 0; $index$ < $max$; ++$index$) {
            $selected$ $end$

No comments: