[英]Is there any shortcut to add the lambda/func arrow operator => in Visual Stuido 2019?
It's really a simple thing, ReSharper did it for me when I was writing a lambda expression, but I stopped using ReSharper and would like to know if there is any way to auto-complete a lambda or func operation with the =>
这真的是一件简单的事情,ReSharper 在我编写 lambda 表达式时为我完成了它,但我停止使用 ReSharper 并想知道是否有任何方法可以自动完成 lambda 或 func 操作
=>
builder.HasKey(m => m.Id);
Following the @Sajeetharan tip, I created this snippet, but I would like to use it in a more simple way, I need to press tab 2 times and after that press enter, I'm not sure if it is efficient at all, almost returning to resharper for these little things按照@Sajeetharan 的提示,我创建了这个片段,但我想以更简单的方式使用它,我需要按两次制表符,然后按回车键,我不确定它是否有效,几乎为这些小事返回 reshaper
<?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</Description>
<Author>Nestorzin</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>Name</ID>
<Default>r</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[$Name$ => $Name$$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
There is NO
shortcut available.没有可用的
NO
方式。 Certainly you can define one code snippet and insert,当然,您可以定义一个代码片段并插入,
<?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>Bestorzin</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:\YourName\Documents\Visual Studio 201?\Code Snippets\Visual C#\My Code Snippets
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.