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