Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any hotkeys to intellisense a lambda in visual studio?

I find that typing lambdas can be cumbersome in visual studio. Is there any shortcut for a lambda expressions similar to how you can type ctor to generate a constructor? Even something as simple as m => m.[StartIntellisenseHere] or () => would be good to have some quick snips for. Are there any hotkeys like this I'm unaware of out of the box in Visual Studio, or with a free add in/extension?

like image 680
Hunter Nelson Avatar asked Dec 07 '25 02:12

Hunter Nelson


1 Answers

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

like image 87
Marco Avatar answered Dec 08 '25 16:12

Marco