/
val1.snippet
41 lines (41 loc) · 1.2 KB
/
val1.snippet
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
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Value (1)</Title>
<Shortcut>val1</Shortcut>
<Description>Code snippet for creating a simple value type which wraps a single value</Description>
<Author>Ryan Harris</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>valuetype</ID>
<ToolTip>Value Type</ToolTip>
<Default>ValueObject</Default>
</Literal>
<Literal>
<ID>type</ID>
<ToolTip>Property type</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>field</ID>
<ToolTip>field name</ToolTip>
<Default>myField</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[public sealed class $valuetype$ : Value
{
private readonly $type$ _$field$;
public $valuetype$($type$ $field$$end$) => _$field$ = $field$;
protected override IEnumerable<ValueBase> GetValues() => Yield(_$field$);
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>