﻿<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>Safe way to invoke an event</Title>
            <Shortcut>invoke</Shortcut>
            <Description>Safe way to invoke an event</Description>
            <Author>Microsoft Corporation</Author>  
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal default="true">
                    <ID>event</ID>
                    <Default>MyEvent</Default>
            <ToolTip>Event method to invoke</ToolTip>
                </Literal>
                <Literal>
                    <!-- Editable="false"> -->
                    <ID>MyDelegate</ID>
                    <Default>MyDelegate</Default>
            <ToolTip>Delegate type</ToolTip>
                </Literal>
            </Declarations>
            <Code Language="vjsharp" Format="CData"><![CDATA[// safely invoke an event
{
$MyDelegate$ temp = $event$;
if (temp != null)
{
temp.Invoke($end$);
}
}]]>
</Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>
