Loading

VisualStudio 自己创建的代码片段

cr -- Console.ReadLine()

Console.ReadLine();
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>cr</Title>
			<Shortcut>cr</Shortcut>
			<Description>Console.ReadLine 的代码片段</Description>
			<Author>Microsoft Corporation</Author>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
			</SnippetTypes>
		</Header>
		<Snippet>
			<Declarations>
				<Literal Editable="false">
					<ID>SystemConsole</ID>
					<Function>SimpleTypeName(global::System.Console)</Function>
				</Literal>
			</Declarations>
			<Code Language="csharp"><![CDATA[$SystemConsole$.ReadLine($end$);]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>

gtasync -- 生成GET异步Action返回方法

[HttpGet]
public async Task<IActionResult> Action()
{
	 return Ok();
}
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>gtasync</Title>
            <Shortcut>gtasync</Shortcut>
            <Description>生成GET异步Action返回方法</Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>name</ID>
                    <ToolTip>方法名</ToolTip>
                    <Default>Action</Default>
                </Literal>
            </Declarations>
            <Code Language="csharp"><![CDATA[
            [HttpGet]
            public async Task<IActionResult> $name$()
           {
              $selected$$end$
              return Ok();
           }]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

ptasync -- 生成POST异步Action返回方法

[HttpPost]
public async Task<IActionResult> Action()
{
 	return Ok();
}
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>ptasync</Title>
            <Shortcut>ptasync</Shortcut>
            <Description>生成POST异步Action返回方法</Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>name</ID>
                    <ToolTip>方法名</ToolTip>
                    <Default>Action</Default>
                </Literal>
            </Declarations>
            <Code Language="csharp"><![CDATA[
            [HttpPost]
            public async Task<IActionResult> $name$()
           {
              $selected$$end$
              return Ok();
           }]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

delc -- WPF 绑定委托命令

public DelegateCommand MyPproperty { get; private set; }
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>delc</Title>
      <Author>DotNeter-Hpf</Author>
      <Description>WPF 绑定委托命令</Description>
      <HelpUrl>
      </HelpUrl>
      <Shortcut>delc</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>property</ID>
          <ToolTip>属性名</ToolTip>
          <Default>MyPproperty</Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
      <Code Language="csharp" Delimiter="$"><![CDATA[public DelegateCommand $property$ { get; private set; }]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

delct -- WPF 绑定带泛型委托命令

 public DelegateCommand<int> MyProperty { get; private set; }
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>delct</Title>
      <Author>DotNeter-Hpf</Author>
      <Description>WPF 绑定带泛型委托命令</Description>
      <HelpUrl>
      </HelpUrl>
      <Shortcut>delct</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>type</ID>
          <ToolTip>属性类型</ToolTip>
          <Default>int</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>property</ID>
          <ToolTip>属性名</ToolTip>
          <Default>MyProperty</Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
      <Code Language="csharp" Delimiter="$"><![CDATA[public DelegateCommand<$type$> $property$ { get; private set; }]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

obst -- WPF 创建动态集合

private ObservableCollection<int> myVar;
public ObservableCollection<int> MyProperty
{
	get { return myVar; }
	set
	{
		myVar = value;
		RaisePropertyChanged();
	}
}
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>obst</Title>
      <Author>DotNeter-Hpf</Author>
      <Description>WPF 创建动态集合</Description>
      <HelpUrl>
      </HelpUrl>
      <Shortcut>obst</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>type</ID>
          <ToolTip>属性类型</ToolTip>
          <Default>int</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>field</ID>
          <ToolTip>支持此属性的变量</ToolTip>
          <Default>myVar</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>property</ID>
          <ToolTip>属性名</ToolTip>
          <Default>MyProperty</Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
      <Code Language="csharp" Delimiter="$"><![CDATA[private ObservableCollection<$type$> $field$;
public ObservableCollection<$type$> $property$
{
    get { return $field$; }
    set
    {
        $field$ = value;
        RaisePropertyChanged();
    }
}]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
posted @ 2022-08-24 16:10  DotNeter-Hpf  阅读(21)  评论(0编辑  收藏  举报