&tag(VisualStudio2010/コードスニペット);
*目次 [#e544063b]
#contents
*参考情報 [#t2745c72]
-[[Create a Snippet in Visual Studio 2010 | Visual Studio Tutor:http://www.visualstudiotutor.com/2010/02/create-snippet-visual-studio-2010/]]
-[[Visual Studio 2008 Tip: Resolving Namespaces and Removing Unused Using Statements:http://davidhayden.com/blog/dave/archive/2008/01/29/VisualStudio2008ResolvingNamespacesRemovingUnusedUsingStatementsTip.aspx]]

*C#用 [#qee058d1]
#pre{{
<?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 
        { 
            if ($field$ != value)
            {
                $field$ = value;
	        NotifyPropertyChanged("$property$");
            }
        }
    }
    $end$]]>
      </Code>
    </Snippet>
  </CodeSnippet>
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>notifypc</Title>
      <Shortcut>notifypc</Shortcut>
      <Description>Code snippet for NotifyPropertyChanged</Description>
      <Author>mt</Author>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Code Language="csharp">
        <![CDATA[
    public void NotifyPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null) 
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
    $end$]]>
      </Code>
    </Snippet>
  </CodeSnippet>
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>obs</Title>
      <Shortcut>obs</Shortcut>
      <Description>ObservableCollection</Description>
      <Author>mt</Author>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>type</ID>
          <ToolTip>Property type</ToolTip>
          <Default>string</Default>
        </Literal>
      </Declarations>
      <Code Language="csharp">
        <![CDATA[ObservableCollection<$type$>$end$]]>
      </Code>
    </Snippet>
  </CodeSnippet>
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>propobs</Title>
      <Shortcut>propobs</Shortcut>
      <Description>ObservableCollection Property</Description>
      <Author>mt</Author>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>type</ID>
          <ToolTip>Property type</ToolTip>
          <Default>string</Default>
        </Literal>
	<Literal>
          <ID>field</ID>
          <ToolTip>The variable backing this property</ToolTip>
          <Default>myVar</Default>
	</Literal>
      </Declarations>
      <Code Language="csharp">
        <![CDATA[
        public ObservableCollection<$type$> $field$ {get; set; }
$end$]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
}}


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS