Introduction
We all have a habit of using the new version of Visual Studio as it emerges in the market. Only a few have the habit of reading about its features and also learning about the usage guidelines or tips to use for betterment.
What this article is all about?
This article will help you to know a few features and also the Tips or Tricks to use the Visual Studio which in turn make your daily activities easy and smooth.
Hope this article will be a worth reading that too consumes very less time.
Some of the Tips or Tricks:
- Quick Launch and Search:
Quick launch (Qtrl+Q) is a gift that keeps on giving. You can use it to search anything you need to find in the options or in the menu.
- Roslyn
Roslyn is the new, improved, open-source .NET compiler, written from the ground up exclusively in C#.
It looks exactly the same as the editor you're used to, but offers a much better experience. A lot of modal windows have been replaced with less invasive UI analogies.
- Light bulb
Light bulb - the bulb appears when the analyser has smart refactoring options and suggestions about your code When the light bulb is not available, smart refactoring can be invoked with Ctrl+.
Inline renaming can also be invoked with Ctrl+R,Ctrl+R while the cursor lies on a specific element static using. Using this feature means that you can do away with fully qualified namespace resolution. Instead of Console.WriteLine() you can simply do this using static System.Console;
- WriteLine("Hi this is Bhuvan!");
- Dictionary Initializers:
The dictionaries can be initialized in a new way, as follows,
- static Dictionary<string, string> GetTeachers()
- {
- //Older Version
- var oldStudentData = new Dictionary<string, string>
- {
- {"Bhuvan", "1001" },
- {"Prabhu", "1002" }
- };
- //Newer Version
- var newStudentData = new Dictionary<string, string>
- {
- ["Bhuvan"] = "1001",
- ["Prabhu"] = "1002"
- };
- return newStudentData;
- }
- Null Conditional Operator:
The operator checks to see if a referenced property is initialised and then returns the value. If the property under evaluation is not initialised, it will return null.
- var studAddress = student?.Address;
- Selecting Block of code:
When you want to select a complete code block very quickly. Keep you cursor either at the starting or at the ending braces, then all you have to do is Just press Ctrl + Shift + ] . You will find the complete code block is being selected.
* Select the cursor at the starting of the block and Press Ctrl + Shift + ] the entire block is selected.
- ‘forr’ code snippet for reverse ‘for’ loop:
When you type the word "forr" then, that will generate a reverse for-loop as shown below.
- for(int i=Length-1; i>=0; i--)
- {
- //your codes...
- }
- “Shift+Enter” to add “;” semi-colon at end of the line automatically:
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.
- Exception Filters: Here the exception can be handled with "When" in the catch block:
- try
- {
- throw new Exception("myError");
- }
- catch (Exception ex) when (ex.Message == "NullException")
- {
- // this is custom error, so this part will not execute.
- }
- catch (Exception ex) when (ex.Message == "Error")
- {
- // expected exception so, this will execute
- WriteLine("myError Occurred");
- }
- Auto property initializer:
This "Auto property initializer" will helps to intialize values automatically , you can initialize properties with default values, without the need for a constructor, as follows
public string studentName { get; set; } = "Mili";
- Change auto-insertion of IntelliSense options as you enter code:
To enable suggestion mode, choose the Ctrl + Alt + Spacebar keys, or, on the menu bar, choose Edit, IntelliSense, Toggle Completion Mode.
- Use Built-In code snippets:
You can use built-in snippets or create your own snippets.
To insert a snippet, on the menu bar, choose Edit, IntelliSense, and Insert Snippet or open the shortcut menu in a file and choose Insert Snippet.
- Bookmark lines of code:
To set a bookmark, on the menu bar, choose Edit, Bookmarks, Toggle Bookmark. You can view all of the bookmarks for a solution in the Bookmarks window.
- Debugging Short Cuts:
Activity Short Cut - Key Start Debugging F5 Stop Debugging Shift+F5 Restart Debugging Ctrl+Shift+F5 Step Over F10 Step Into F11 Step Out Shift+F11 Run To Cursor Ctrl+F10 Set Next Statement Ctrl+Shift+F10 Set and Toggle Breakpoint F9 Disable Breakpoint Ctrl+F9 Immediate Window Ctrl+Alt+I Immediate Window Command Mode Type “>” Immediate Window Clear Buffer >cls Immediate Window Print Value ?varname
Read more articles on Visual Studio:

kalu singh raoPosted Jul 2, 2016, 3:23 PM
Nice...
Bhuvanesh MohankumarPosted May 29, 2016, 9:49 AM
Thanks harinath shivanadhuni
Bhuvanesh MohankumarPosted May 29, 2016, 9:49 AM
Thanks Thiruppathi R
Bhuvanesh MohankumarPosted May 29, 2016, 9:49 AM
Thanks Kuppurasu Nagaraj
Bhuvanesh MohankumarPosted May 29, 2016, 9:49 AM
Thanks VIJAYASHANKAR PALANICHAMY
harinath shivanadhuniPosted May 24, 2016, 2:17 AM
Nice useful infomation
Thiruppathi RPosted May 23, 2016, 3:17 PM
Great..
Kuppurasu NagarajPosted May 23, 2016, 1:35 PM
Nice Sharing..
Vijayashankar PalanichamyPosted May 23, 2016, 12:20 PM
Great tips to every one.. It makes more expectation for your future posts...
Bhuvanesh MohankumarPosted May 23, 2016, 3:41 AM
Thanks Pradeep Sahoo
Bhuvanesh MohankumarPosted May 23, 2016, 3:41 AM
Thanks Sabyasachi Mishra
Pradeep SahooPosted May 22, 2016, 1:42 AM
Nice article .Thanks for sharing ...........
Sabyasachi MishraPosted May 20, 2016, 12:20 AM
Nice one
Bhuvanesh MohankumarPosted May 17, 2016, 2:14 PM
Thanks Ipsita Sethi
Ipsita SethiPosted May 11, 2016, 1:33 PM
Great article & useful Bhuvan
NitinPosted May 6, 2016, 3:33 AM
nice
Vivek KumarPosted Apr 30, 2016, 9:21 AM
Nice one
Thiruppathi RPosted Apr 29, 2016, 8:09 AM
Useful Info..
Former memberPosted Apr 28, 2016, 8:24 AM
Good One ..
Pankaj Kumar ChoudharyPosted Apr 28, 2016, 6:00 AM
Nice Article ......
sreenivasa kPosted Apr 27, 2016, 11:59 PM
nice one
Amit AggarwalPosted Apr 27, 2016, 2:11 PM
Gud bhai. Please add some more like this.
Allen OneillPosted Apr 27, 2016, 11:09 AM
var studAddress = student?.Address; ... how useful!
Pradeep SahooPosted Apr 26, 2016, 10:47 PM
Good Tips .Thanks for sharing
Muhammad Aqib ShehzadPosted Apr 26, 2016, 11:21 AM
nice share