Skip to content

Instantly share code, notes, and snippets.

@pinzolo
Created May 27, 2012 13:40
Show Gist options
  • Save pinzolo/2814250 to your computer and use it in GitHub Desktop.
Save pinzolo/2814250 to your computer and use it in GitHub Desktop.
独自イベント定義用コードスニペット
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>ev</Title>
<Shortcut>ev</Shortcut>
<Description>イベント用のコード スニペット</Description>
<Author>pinzolo</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>eventName</ID>
<ToolTip>イベント名</ToolTip>
<Default>Event</Default>
</Literal>
<Literal>
<ID>description</ID>
<ToolTip>このイベントの概要</ToolTip>
<Default>Description</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[#region $eventName$
/// <summary>
/// $description$
/// </summary>
public event EventHandler<$eventName$EventArgs> $eventName$;
/// <summary>
/// $eventName$イベントを発生させる。
/// </summary>
/// <param name="e">イベント引数</param>
protected virtual void On$eventName$($eventName$EventArgs e)
{
if (this.$eventName$ == null) { return; }
this.$eventName$(this, e);
}
#endregion$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment