我在VS2010中创建了一个代码片段,但在我开始输入时没有显示为快捷方式。它被命名为propnch。
当我使用Ctrl-K、Ctrk-X时可以看到它,但是当我只是输入prop...时,它不会显示为选项。
我是否错过了某种设置?
我有截图,但我认为SO不允许上传任何东西。
编辑:屏幕截图
我可以使用Ctrl-K、Ctrl-X看到我的代码片段(当我使用ctrl-PrtScn截图时,它变成了灰色)
但它不会出现在其他代码片段的快捷方式中。
代码片段在此处(取自这篇教程),位于“文档\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets”文件夹中。
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>propnch</Title>
<Shortcut>propnch</Shortcut>
<Description>Code snippet for property and backing field and ensure
that it invokes INotifyPropertyChanigng and INotifyPropertyChanged</Description>
<Author>Abhishek</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>Property type</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>property</ID>
<ToolTip>Property name</ToolTip>
<Default>MyProperty</Default>
</Literal>
<Literal>
<ID>field</ID>
<ToolTip>The variable backing this property</ToolTip>
<Default>myVar</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[
private $type$ $field$;
public $type$ $property$
{
get
{
return $field$;
}
set
{
this.OnPropertyChanging("$property$");
$field$ = value;
this.OnPropertyChanged("$property$");
}
}
$end$]]>
</Code>
</Snippet>
</CodeSnippet>
propnch
的代码片段,并且它工作正常。 - p.campbell