10 Visual Studio Tips and Tricks for Junior Developers | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (174).NET Core  (29).NET MAUI  (207)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (40)Black Friday Deal  (1)Blazor  (215)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (118)PDF  (81)Python  (1)React  (100)Streamlit  (1)Succinctly series  (131)Syncfusion  (914)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (147)Chart  (131)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (628)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (507)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (592)What's new  (332)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Visual Studio 10 tips

10 Tips and Tricks in Using Visual Studio for Junior Developers

Overview

If you are new to Visual Studio or in the beginner stage of your developer career, here are 10 tips that will help you make effective use of Visual Studio:

  1. Debugging
  2. Breakpoints
  3. DataTips
  4. Watch window
  5. Immediate window
  6. IntelliSense
  7. Quick Navigation/Go To
  8. Bookmarks
  9. Code cleanup
  10. Customize fonts

Debugging

The difference between debugging and executing a program is that debugging can hold the execution at any instant. To debug your application, press F5, or select Debug > Start Debugging, or click the green arrow in the Visual Studio toolbar.

Start Debugging Option in Visual Studio

Start Debugging Option in Visual Studio

Note: To run your application without debugging, press CTRL+F5 or select Debug > Start Without Debugging. This will run your application by skipping all enabled breakpoints.

Breakpoints

Breakpoints are checkpoints intentionally added to pause the execution of the program, allowing you to investigate the code. You can add breakpoints anywhere in the code except on lines of declaration. In the classical way of debugging code, we should start debugging from line 1 to the point where we think the problem resides.

Visual Studio provides several ways to include a breakpoint in your code:

  • Click the far-left margin of the line of code.
  • Place the cursor on the line where you want to add a breakpoint and press
  • Select Debug > Toggle Breakpoint.
  • Right-click and select Breakpoint > Insert Breakpoint.

In the following screenshot, the yellow highlight is where the program execution will stop because of a breakpoint.

Code with Breakpoint

Code with Breakpoint

Traverse through the code

There are two ways to traverse through code. They are:

  • Step Into
  • Step Over

The Step Into traverse navigates through every line of code. When an object is defined or a method is invoked, it traverses into the object/method definitions. Use Debug > Step Into or press F11 to use Step Into traversing.

The Step Over traverse bypasses object creation and method definition. Use Debug > Step Over or press F10 to use Step Over traversing.

DataTips

DataTips can be seen during runtime when the program execution hits a breakpoint. This can be used to examine the values of the variables that are in the scope of a breakpoint. Mouse over a variable in the scope to examine it. If the variable is a basic data type like int, float, string, and so on, you can find its value directly. If it is a complex type such as list, dictionary, or a class object, then you can examine its direct values as well as the values of its children.

DataTip with a Basic Data Type

DataTip with a Basic Data Type

You can pin a DataTip so that it stays open by selecting the Pin to source pushpin icon.

Pinned DataTip

Pinned DataTip

To unpin or close the pinned DataTip, click the Unpin or Close icons respectively.
Closing a Pinned DataTip

Closing a Pinned DataTip

Watch window

The Watch window provides an advanced way to examine a variable. To watch a variable while debugging, add it to the Watch window by right-clicking the variable or the DataTip and selecting Add Watch. The variable will appear in the Watch window.

The Watch window is primarily used to examine complex objects.
Variables in the Watch Window

Variables in the Watch Window

Immediate window

You can use the Immediate window to debug, evaluate expressions, execute statements, and print variable values. The Immediate window evaluates expressions by building and using the currently selected project. To display the Immediate window, select Debug > Windows > Immediate or press CTRL+ALT+I. The Immediate window also supports IntelliSense.

For example, to display the value of a variable num, you can use the following command:

? num

To display the value of an evaluated expression, you can use commands like:

? num + num1 – 50

? num = DateTime.Now.Day + num1

Immediate Window in Visual Studio

Immediate Window in Visual Studio

You can cut, copy, paste, and clear the content of the Immediate window by choosing the relevant options in the context menu that appears when right-clicking on it.
Immediate Window Context Menu

Immediate Window Context Menu

IntelliSense

IntelliSense is a code-completion tool that helps you finish a line of code. This not only provides suggestions to complete a word, but also lists all the properties, methods, and events associated with an object. When invoking a method, IntelliSense will provide information about the type of parameter to be passed and the return type of the method.

The IntelliSense search results use fuzzy matching to provide suggestions. For example, the results list for List Members includes not only entries that start with the characters that you have entered, but also entries that contain the character combination anywhere in their names.
IntelliSense Suggestions

IntelliSense Suggestions

Quick Navigation or Go To

To open the Go To window, press CTRL+T or click Edit > Go To. Go to All enables you to jump to any file, type, member, or symbol declaration quickly.
Go to All Option

Go to All Option

Bookmarks

You can use bookmarks to navigate quickly to specific lines of code in a file.

To set a bookmark, choose Edit > Bookmarks > Toggle Bookmark or press CTRL+K, CTRL+K. You can view all the bookmarks for a solution in the Bookmarks window. To show the Bookmarks window, click View > Bookmark Window or press CTRL+K, CTRL+W.
Bookmarks Window

Bookmarks Window

Code Cleanup

Visual Studio 2019 provides on-demand formatting of a code file, including code style preferences, through the Code Cleanup feature. To run Code Cleanup, click the broom icon at the bottom of the editor or press CTRL+K, CTRL+E.
Code Cleanup Option

Code Cleanup Option

Customize Fonts

You can change the font face, size, and color that is used for text in the IDE. For example, you can customize the color of specific code elements in the editor and the font face in tool windows or throughout the IDE.

To change the fonts, go to Tools > Options > Environment > Fonts and Colors.
Customizing Fonts in Visual Studio

Customizing Fonts in Visual Studio

Conclusion

In this blog, we have learned about using various tips and tricks in Visual Studio, that I wish I knew about when I was starting out as a developer! Hopefully, this has been useful for you or any new coders in Visual Studio. If there are any Visual Studio tools that you consider essential basics but weren’t mentioned in this blog, please post them in the comments below. We will compile and post them as another blog.

Happy coding!

Tags:

Share this post:

Comments (4)

… [Trackback]

[…] Read More here: blog.syncfusion.com/blogs/post/10-visual-studio-tips-for-junior-developer.aspx […]

[…] on August 22, 2019by admin submitted by /u/prabakarinfo [link] [comments] No comments […]

Those tips are really helpful for me. Thanks a lot for sharing.

I really like this post. Thanks for sharing.

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed