【发布时间】:2012-03-07 01:15:02
【问题描述】:
您好,我想创建一个 Visual Studio sn-p,我可以将预定义的值用于...
例如
<Timeline AutoPlay="$True|FALSE$">
有没有办法做到这一点?
除了 Default 之外,是否还有其他标签可以让我添加可能的值?
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/CodeSnippet">
<CodeSnippet>
<Header>
<!-- Add Header information here -->
</Header>
<Snippet>
<!-- Add additional Snippet information here -->
<Declarations>
<Literal>
<ID>SqlConnString</ID>
<ToolTip>Replace with a SQL connection string.</ToolTip>
**<Value>"Value1"</Value>
<Value>"Value2"</Value>**
<Default>"SQL connection string"</Default>
</Literal>
<Object>
<ID>SqlConnection</ID>
<Type>System.Data.SqlClient.SqlConnection</Type>
<ToolTip>Replace with a connection object in your application.</ToolTip>
<Default>dcConnection</Default>
</Object>
</Declarations>
<Code Language="CSharp">
<![CDATA[
daCustomers = new SqlClient.SqlDataAdapter();
selectCommand = new SqlClient.SqlCommand($SqlConnString$);
daCustomers.SelectCommand = selectCommand;
daCustomers.SelectCommand.Connection = $SqlConnection$;
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
【问题讨论】:
-
优秀设计的标志。你可以无休止地想出你想要包括的东西。好的设计是知道要忽略什么。片段是为程序员设计的。
-
是的,这就是您添加更多功能的原因,实际上没有人需要所有 MS Office 功能,但有些人确实需要...
标签: visual-studio-2010 code-snippets