带有DateTime.Now的自定义代码段

mat*_*con 4 c# datetime visual-studio-2010 code-snippets

我正在尝试为VS2010中的C#代码创建一个小的自定义代码段.它基本上插入了一个注释块以供参考.虽然我希望在插入代码段时自动插入当前日期,但在此代码中.

这是我目前的片段:

<CodeSnippet Format="1.0.0">
    <Header>
        <Title>
            C# Class Comments
        </Title>
        <Shortcut>ccom</Shortcut>
    </Header>
    <Snippet>
        <Declarations>
            <Object>
                <ID>DateTime</ID>
                <Type>System.DateTime</Type>
                <Function>DateTime.Now()</Function>
            </Object>
            <Literal>
                <ID>Author</ID>
                <ToolTip>Replace with name creator of class.</ToolTip>
                <Default>"Author name"</Default>
            </Literal>
            <Literal>
                <ID>Date</ID>
                <ToolTip>Replace with date class was created</ToolTip>
                <Default>"Date"</Default>
            </Literal>
            <Literal>
                <ID>Modified</ID>
                <ToolTip>Replace with modified date of class</ToolTip>
                <Default>"Modified"</Default>
            </Literal>
            <Literal>
                <ID>Description</ID>
                <ToolTip>Replace with a short description of what the class is used for</ToolTip>
                <Default>"Description"</Default>
            </Literal>
        </Declarations>
        <Code Language="CSharp">
            <![CDATA[
            //*******************************************************************************;
            // Author:          $Author$
            // Created Date:    $DateTime$
            // Modified Date:   $Modified$
            // Description:     $Description$
            //*******************************************************************************;
            ]]>
        </Code>
    </Snippet>
</CodeSnippet>
Run Code Online (Sandbox Code Playgroud)

如何插入代码片段插入代码的日期,我该怎么做?

Jar*_*Par 7

遗憾的是,这不太可能.Visual Studio代码段架构不支持替换宏,例如当前日期/时间