代码改变世界

[VS2005]一个简单的CodeSnippet —— 生成类的构造函数。

2006-02-20 10:39  Colin Han  阅读(760)  评论(0编辑  收藏  举报
VS2005的CodeSnippet,用于在类中自动生成构造函数。
 1<?xml version="1.0" encoding="utf-8" ?>
 2<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
 3    <CodeSnippet Format="1.0.0">
 4        <Header>
 5            <Title>ctor region</Title>
 6            <Shortcut>ctorc</Shortcut>
 7            <Description>Code snippet for constructor that contains a group of region sentence</Description>
 8            <Author>Colin Han</Author>
 9            <SnippetTypes>
10                <SnippetType>Expansion</SnippetType>
11            </SnippetTypes>
12        </Header>
13        <Snippet>
14            <Declarations>
15                <Literal Editable="false">
16                    <ID>classname</ID>
17                    <ToolTip>Class name</ToolTip>
18                    <Function>ClassName()</Function>
19                    <Default>ClassNamePlaceholder</Default>
20                </Literal>
21                <Literal>
22                    <ID>args</ID>
23                    <Default></Default>
24                    <ToolTip>Arguments of this constractor</ToolTip>
25                </Literal>
26            </Declarations>
27            <Code Language="csharp"><![CDATA[#region Constructor
28
29    /// <summary>
30    ///   Create and initialize a $classname$ object.
31    /// </summary>
32    public $classname$ ($args$)
33    {
34        $end$
35    }
36
37    #endregion]]>
38            </Code>
39        </Snippet>
40    </CodeSnippet>
41</CodeSnippets>