summaryrefslogtreecommitdiffstats
path: root/tools/Contracts/Languages/CSharp/Code Contract Snippets/contractensuresnonnull.snippet
diff options
context:
space:
mode:
Diffstat (limited to 'tools/Contracts/Languages/CSharp/Code Contract Snippets/contractensuresnonnull.snippet')
-rw-r--r--tools/Contracts/Languages/CSharp/Code Contract Snippets/contractensuresnonnull.snippet32
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/Contracts/Languages/CSharp/Code Contract Snippets/contractensuresnonnull.snippet b/tools/Contracts/Languages/CSharp/Code Contract Snippets/contractensuresnonnull.snippet
new file mode 100644
index 0000000..3e4f24b
--- /dev/null
+++ b/tools/Contracts/Languages/CSharp/Code Contract Snippets/contractensuresnonnull.snippet
@@ -0,0 +1,32 @@
+<?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>Contract.Ensures(Contract.Result() != null)</Title>
+ <Shortcut>cen</Shortcut>
+ <Description>Emits an 'ensures' clause specifying result not null</Description>
+ <Author>Jonathan de Halleux</Author>
+ </Header>
+ <Snippet>
+ <Imports>
+ <Import>
+ <Namespace>System.Diagnostics.Contracts</Namespace>
+ </Import>
+ </Imports>
+ <Declarations>
+ <Object Editable="true">
+ <ID>type</ID>
+ <ToolTip>the method return type</ToolTip>
+ <Default>string</Default>
+ <Function>
+ </Function>
+ </Object>
+ </Declarations>
+ <Code Language="CSharp" Kind="method body"><![CDATA[Contract.Ensures(Contract.Result<$type$>() != null);
+$end$]]></Code>
+ </Snippet>
+ </CodeSnippet>
+</CodeSnippets>