C# 带有DateTime.Now的自定义代码段
我试图在VS2010中为我的C#代码创建一个小的自定义代码段。它基本上插入一个注释块用于提供信息。在这段代码中,我希望插入代码段时自动插入当前日期 以下是我当前的代码片段:C# 带有DateTime.Now的自定义代码段,c#,visual-studio-2010,datetime,code-snippets,C#,Visual Studio 2010,Datetime,Code Snippets,我试图在VS2010中为我的C#代码创建一个小的自定义代码段。它基本上插入一个注释块用于提供信息。在这段代码中,我希望插入代码段时自动插入当前日期 以下是我当前的代码片段: <CodeSnippet Format="1.0.0"> <Header> <Title> C# Class Comments </Title> <Shortcut>ccom</S
<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>
C#课堂评论
ccom
日期时间
系统日期时间
DateTime.Now()
作者
替换为类的创建者名称。
“作者姓名”
日期
替换为创建日期类
“日期”
被改进的
替换为修改后的上课日期
“修改”
描述
替换为对类的用途的简短描述
“说明”
要将代码段插入代码中的日期插入到代码中,我必须做些什么?不幸的是,这实际上是不可能的。Visual Studio代码段体系结构不支持替换宏以替换当前日期/时间等不可能的项。你需要一个宏来代替。哦,好吧,因为我看到了一些关于函数的东西,但不太知道如何使用它们,并且认为这会起作用