您好我想创建一个Visual Studio代码段,我可以预定义值...
例如
<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>
答案 0 :(得分:3)
听起来您想在Visual Studio Snippet中进行宏替换。不幸的是,这不太可能。 Visual Studio片段仅支持非常少量的替换宏,并且它们不是用户可控制的。
答案 1 :(得分:2)