From the course: Visual Studio Developer Tips
Unlock this course with a free trial
Join today to access over 22,500 courses taught by industry experts.
Surround a block of code with a code snippet - Visual Studio Tutorial
From the course: Visual Studio Developer Tips
Surround a block of code with a code snippet
- [Teacher] In this video I'll look at the Surround With feature. It's really a special form of code snippets, one that knows how to expand a code snippet around an existing block of code without destroying it in the process. I'll start by looking at how you use a code snippet. I'll use the try snippet. So you type in "T-R-Y" and then you get this Intellisense in the autocomplete window. I also can read that I can press the Tab twice to insert the try snippet. So let's do that, press the Tab key twice. And that stubs in the body of the snippet, which is a try block and a catch block. But now I have to take my code and cut it and paste it. So let's use the surround with so I don't have to do that extra step. Put my code back in here. Then I'll select it and then right-click and choose Surround With. Also note the keystroke "Control+K", "Control+S". I'll use that later. So I choose Surround With. This autocomplete list gives me a short list of snippets that are surround-with-aware. In…
Contents
-
-
-
Brace matching in C#4m 57s
-
(Locked)
Select vertical sections of code with Box Selection5m 50s
-
(Locked)
Move code with keyboard shortcuts2m 49s
-
(Locked)
Find duplicate code with the code clone analysis tool4m 8s
-
(Locked)
Paste JSON/XML as class3m 42s
-
(Locked)
Colorize output in the build window4m 37s
-
(Locked)
A better way to redock a tool window3m 57s
-
(Locked)
The Open Command Line extension3m 39s
-
Get consistent editor settings with EditorConfig3m 46s
-
(Locked)
Git at a glance: Updates to the Visual Studio status bar4m 1s
-
(Locked)
Surround a block of code with a code snippet2m 5s
-
(Locked)
Understand the document tab features3m 35s
-
(Locked)
Clipping to a border using an opacity mask5m 53s
-
(Locked)
Insert Line with Ctrl Enter2m 21s
-
(Locked)
Use the File Tab channel3m 31s
-
(Locked)
Use the Add New File extension4m 27s
-
(Locked)
Keyboard access for CodeLens4m 32s
-
(Locked)
Use the Clipboard Ring2m 56s
-
(Locked)
Use the GlyphFriend extension5m 41s
-
(Locked)
Activate Open File in Solution Explorer3m 14s
-
(Locked)
Use the enhanced scrollbar41s
-
(Locked)
Drag and drop in Solution Explorer5m 20s
-
(Locked)
Keyboard shortcuts for MVC views and controllers4m 17s
-
(Locked)
Pin data tips in debug window6m 6s
-
(Locked)
The Trailing Whitespace Visualizer extension4m 19s
-
(Locked)
Date rounding and other helpers5m 21s
-
(Locked)
Memorize window layout (Reuse)4m 26s
-
Use DialogResult6m 48s
-
(Locked)
Label a breakpoint2m 31s
-
(Locked)
The Image Optimizer extension2m 35s
-
(Locked)
Use Ctrl+Spacebar to fix case of variable names3m 40s
-
(Locked)
Use the nameof operator6m 21s
-
Discover untested code with code coverage7m 36s
-
(Locked)
Use the Hand tool in XAML designer2m 16s
-
(Locked)
Array Visualizer extension2m 35s
-
(Locked)
Use Ctrl+Tab to cycle through windows3m 18s
-
(Locked)
Understand line stroke patterns4m 37s
-
(Locked)
The Comment Remover extension3m 41s
-
(Locked)
Toolbox tip shortcuts6m 1s
-
(Locked)
Randomize data with LINQ4m 13s
-
Customize context menu4m
-
(Locked)
Get the file path1m 25s
-
(Locked)
Convert lists4m 34s
-
(Locked)
Enum flags5m 19s
-
(Locked)
Reference highlighting2m 4s
-
(Locked)
Evaluate performance with PerfTips4m 50s
-
(Locked)
Null propagation4m
-
(Locked)
Multiple editor views of same file2m 17s
-
(Locked)
Customize the output window7m 37s
-
(Locked)
Colored braces with the Viasfora extension4m 15s
-
(Locked)
Use the C# interactive window10m 47s
-
(Locked)
The Smart Semicolon extension3m 29s
-
(Locked)
Reference Highlighting1m 35s
-
(Locked)
IEnumerable Extension Methods4m 58s
-
Compare LiNQ sequences6m
-
(Locked)
The Clear Recent Project List extension3m 34s
-