4
我想在VS2010中爲我的C#代碼創建一個小的自定義代碼片段。它基本上插入了一個註釋塊來提供信息。在這段代碼中,雖然我希望在插入片段時自動插入當前日期。用DateTime.Now自定義代碼片段
這裏是當前片斷我:
<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>
我有什麼做的插入片斷插入代碼的日期?
這是不可能的。你需要一個宏來代替。 – 2012-01-28 21:09:56