2
我創建了以下簡單摘錄Visual Studio代碼片段重構
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Observable Property</Title>
<Description>Generates an Observable property based on type and Name</Description>
<Shortcut>nosp</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>PropertyName</ID>
<ToolTip>Defines the Property Name</ToolTip>
<Default>Name</Default>
</Literal>
<Literal>
<ID>PropertyType</ID>
<Type>Type</Type>
<ToolTip>Defines the Property Type</ToolTip>
<Default>String</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[
public $PropertyType$ $PropertyName$
{
get { return Get<$PropertyType$>("$PropertyName$"); }
set
{
Set("$PropertyName$", value);
}
}
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
及其工作像預期的那樣創造例如
public VirtualKeyCode Key
{
get { return Get<VirtualKeyCode>("Key"); }
set
{
Set("Key", value);
}
}
是否有可能改變這一切$屬性類型$位置時的一個例如在重構期間,它們在初始插入代碼片段後發生了變化?