2012-01-28 4 views
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> 

私はスニペットをコードに挿入された日付を挿入するために行うには何がありますか:ここでは

は、私が持っている現在のスニペットのですか?

+0

これは不可能です。代わりにマクロが必要です。 –

答えて

6

これは残念ながら実際には可能ではありません。 Visual Studioのスニペットアーキテクチャは、現在の日付/時刻などの項目の置換マクロをサポートしていません。

+0

オハイオ州オクラホマ、私は機能について何かを見たが、それらを使う方法をあまり知らなかったので、それがうまくいくと思った – mattgcon

関連する問題