Put Braces On New Line When Hitting Enter Visual Studio For Mac
Introduced many new features for VS developer. Here I am going to talk about one small but useful features of the productivity tool. You can use “Shift + Enter” to add semicolon (;) to end of the line. Instead of putting “;” end of the line, you just press “Shift+Enter”. It will automatically add “;” at the end of the line and will move the cursor to next line. As shown in the picture. If you press “Shift+Enter” over there, power tool will automatically add “;” and the end and the cursor will be moved to next line.
For more features please read following links.
In Options, under Text Editor, C/C++, Formatting, New Lines, I have chosen that opening braces for control blocks be placed on the same line, but with a space before it. If, after creating the control block line, I go to a new line, open a brace (a second brace being created automatically), then hit return to go to the 'next line', the bug occurs.
In this blog entry, I list the essential tips and tricks that every developer who uses Visual Studio 2008 should know. I wanted to keep this list brief. I also wanted to focus on only those tips and tricks that I use on a daily basis. Almost all of these tips and tricks are just as useful regardless of whether you are building an ASP.NET Web Forms or ASP.NET MVC application. Tip #1 – You don’t need to select a line to copy or delete it I always cringe whenever I see someone select an entire line of code in the Visual Studio code editor before copying the line or deleting the line (see Figure 1).
You don’t need to do this. Figure 1 If you want to copy a line of code then you can simply press CTRL-c to copy the line and press CTRL-v to paste the line. If you want to delete a line, don’t select it first, just press CTRL-x.
You’ll be surprised how much time this one tip will save you. Tip #2 – You can add a namespace automatically by pressing CTRL. In the old days, before Visual Studio 2008, if you used a class in your code that was not a member of any of the existing namespaces imported in your code then you had no choice but to look up the class in the documentation and enter a using statement to import the new namespace. Visual Studio 2008 is smart enough to import namespaces for you automatically. If you type the name of a class that inhabits a namespace that has not been imported then Visual Studio displays a red bar beneath the class in the editor (see Figure 2). You can press CTRL. To display a dialog box for picking the right namespace to import.
Finally, just press the ENTER key to select a namespace (see Figure 3). Figure 2 Figure 3 Tip #3 – Never create properties by hand Never type property declarations by hand.
It takes forever! Instead, just type prop + TAB + TAB. When you type prop + TAB + TAB, you get a code snippet (template) for entering a property. Use TAB to move between the template parameters.
Press the ENTER key when you are finished creating the property (see Figure 4). Free car simulator games for mac. This tip has saved me from many days of tedious property typing. Figure 4 Tip #4 – You can remove and sort unnecessary using statements Whenever I finish creating a class, I always clean up the list of using statements that appear at the top of the class file.
I like to remove any unused using statements to reduce the amount of visual clutter in my classes. You can remove using statements that are not required by your code by right-clicking the top of your code file, selecting the menu option Organize Usings, and select Remove and Sort. Figure 5 Tip #5 – Use CTRL-k+c to comment out code If you need to temporarily disable a block of code, or a section of an ASP.NET page, then you can comment out the region by pressing CTRL-k+c. I always do this when I want to rewrite an existing section of code, but I am afraid to delete the old code before writing the new code. For example, Figure 6 illustrates commented out code in the code editor.