-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheventarg.snippet
More file actions
44 lines (42 loc) · 1.47 KB
/
eventarg.snippet
File metadata and controls
44 lines (42 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2010/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>イベントハンドラー(パラメータあり)</Title>
<Description>イベントの定義と発生するメソッド、イベント引数クラスを作成します。</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Shortcut>eventarg</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>eventName</ID>
<ToolTip>イベントハンドラーの名前</ToolTip>
<Default>Event</Default>
</Literal>
</Declarations>
<Code Language="csharp" Kind="method decl">
<![CDATA[public event EventHandler<$eventName$EventArgs> $eventName$;
/// <summary>
/// <see cref="$eventName$"/>イベントを発生させます。
/// </summary>
protected virtual void On$eventName$($eventName$EventArgs e)
{
var handler = $eventName$;
if (handler != null)
{
handler(this, e);
}
}
/// <summary>
/// <see cref="$eventName$"/>イベントで渡すデータです。
/// </summary>
public class $eventName$EventArgs : EventArgs
{
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>