Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# $selected$仅在自定义visual studio c代码段中使用一次_C#_Visual Studio_Code Snippets - Fatal编程技术网

C# $selected$仅在自定义visual studio c代码段中使用一次

C# $selected$仅在自定义visual studio c代码段中使用一次,c#,visual-studio,code-snippets,C#,Visual Studio,Code Snippets,我的自定义代码段只包含一次$selected$。如何多次使用$selected$ 片段: 输出: 集合缺少$selected$中的值。请检查此MSDN引用以获取 在代码段中不能多次使用$end$或$selected$。谢谢。我必须说这很奇怪。我会认为你使用一台电脑多少次都无关紧要!我想我们今天都学到了一些东西。。。这对我来说也是新闻。 <?xml version="1.0" encoding="utf-8"?> <CodeSnippets xmlns="http://schem

我的自定义代码段只包含一次$selected$。如何多次使用$selected$

片段:

输出:


集合缺少$selected$中的值。

请检查此MSDN引用以获取


在代码段中不能多次使用$end$或$selected$。

谢谢。我必须说这很奇怪。我会认为你使用一台电脑多少次都无关紧要!我想我们今天都学到了一些东西。。。这对我来说也是新闻。
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
      <Title>Creates a collection using ICollection from the selected entity</Title>
      <Author>Stein Lundbeck</Author>
      <Description>Select entity and the snippet implements ICollection with the selected entity</Description>
      <Shortcut>icoll</Shortcut>
      <Keywords>
        <Keyword>C#</Keyword>
        <Keyword>Collection</Keyword>
        <Keyword>Entity</Keyword>
      </Keywords>
    </Header>
    <Snippet>
    <Imports>
        <Import>
          <Namespace>System.Collections.Generic</Namespace>
        </Import>
        <Import>
          <Namespace>System.Collections.ObjectModel</Namespace>
        </Import>
    </Imports>
    <Declarations>
        <Literal Editable="true">
            <ID>Name</ID>
            <ToolTip>Name of variable</ToolTip>
            <Default>myVar</Default>
        </Literal>
    </Declarations>
        <Code Language="csharp" Delimiter="$" Kind="file">
            <![CDATA[ICollection<$selected$> $Name$ = new Collection<$selected$>();

            $end$]]>      
        </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Test
{
    class MyClass
    {
        ICollection<int> myVar = new Collection<>();
    }  
}