我发现在视觉工作室中输入lambda可能很麻烦。是否有类似于键入ctor生成构造函数的lambda表达式的快捷方式?即使像m => m.[StartIntellisenseHere]
或() =>
这样简单的事情也可以为您提供快速剪辑。有没有像这样的热键我不知道Visual Studio中的开箱即用,还是免费添加/扩展?
答案 0 :(得分:3)
No. But you can define your own:
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>lambda</Title>
<Shortcut>lambda</Shortcut>
<Description>Code snippet for lambda statement</Description>
<Author>Me</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Code Language="csharp"><![CDATA[(() =>
{
$selected$ $end$
});]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
And save it on C:\Users[YOU]\Documents\Visual Studio 201?\Code Snippets\Visual C#\My Code Snippets