The Goal
Write codenippet which produces this result: .Select(k => new { })
The test snippet body
<Header>
<Title>SelectAnonymous</Title>
<Shortcut>selectAnonymous</Shortcut>
<Description>Shortcut for creating Selects with an anonymous object.</Description>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>ParamName</ID>
<ToolTip>The name of the parameter</ToolTip>
<Default>x</Default>
</Literal>
</Declarations>
<Code Language="CSharp">
<![CDATA[.Select($ParamName$ => new { $end$ })]]>
</Code>
</Snippet>
The Probem
Visual Studio doesn't suggest using code snippets when chaining methods like this: dummyObjectList.selectAnonymous
, it only suggest methods at that point.
The Question
Is it possible to "teach" Visual Studio or to alter the Code Snippet in such a way that Visual Studio would suggest using the snippet along side the existing methods (while chaining methods as described above)?
The Tech
Visual Studio 2019
The Struggle
Is Real
.Select(v => { key1, key2 } ).ToDictionary(k => key1, k => key2)
– Radloff