Learn how to collapse and expand sections of your code while editing in Visual Studio 2015. Collapsed code is hidden from sight, which makes it easy to concentrate on the current task. Find out how to add custom labels to outlined code with the region and how the "surround with" snippet makes inserting regions even easier.
- When you are faced with editing hundreds of lines of code,…you need a way to hide the parts that are not important…for your immediate task.…Visual Studio provides code outlining…and code regions for these scenarios.…Now, code outlining is automatic…in some of the language editors.…It happens as soon as you open the file.…Let me show you an example in this Book.cs file.…I'll double-click on this to open the file,…and along the left margin you'll see…that there is a set of black lines next to the line numbers…and a minus symbol inside a square box.…
Now, that appeared after about one or two seconds.…Let me show you that again.…Keep you eye on that left margin…the next time I open this file.…What's happening is the code editor is looking…for certain constructs inside this file,…and when it finds them,…then it puts the outlining glyph in the left margin.…So, what can I collapse?…Well, it looks like I can collapse…this using System section up here.…I can also collapse my namespace,…my class, or all types inside my project.…
- Exploring the code editor window and default settings
- Commenting code
- Using hover tips and IntelliSense
- Tracking changes
- Refactoring code
- Formatting and arranging code
- Navigating and inspecting code
- Using the Task List
- Working with snippets and smart tags
Skill Level Intermediate
Q: This course was updated on 08/21/2017. What changed?
A: New videos were added that cover visualizing code and markup with structure guidelines in Visual Studio 2017; refactor enhancements in Visual Studio 2017; format rules for C# in Visual Studio 2017; format rules for Visual Basic in Visual Studio 2017; smart peek options; and CodeMap in Visual Studio 2017.
1. Work with Code Editors
2. Format Your Code
3. Navigate and Inspect Code
4. Tools for Enhancing Your Coding Sessions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.