【发布时间】:2012-02-21 08:09:23
【问题描述】:
我正在尝试在 VS2010 中为我的 C# 代码创建一个小的自定义 sn-p。它基本上插入一个注释块以供参考。在这段代码中,虽然我希望在插入 sn-p 时自动插入当前日期。
这是我当前的 sn-p:
<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>
我需要做什么才能在代码中插入 sn-p 的日期?
【问题讨论】:
-
这是不可能的。你需要一个宏来代替。
标签: c# visual-studio-2010 datetime code-snippets