You are here
Home > Programming > Visual Studio 2015 Light Bulb – Lighting Your Path To Great Code

Visual Studio 2015 Light Bulb – Lighting Your Path To Great Code

Visual Studio 2015 Light Bulb – If you have been using Visual Studio 2015, you will undoubtedly run into the Light Bulb during your ventures into the new IDE. This is a very handy tip and one that is really easy to make use of. This productivity feature is so subtle but incredibly handy and always in the right place at the right time.

Visual Studio 2015 Light Bulb

Using the code example from yesterday, let us assume that we forgot to include the correct namespace for Thread.Sleep. Visual Studio 2015 will highlight errors in your code as usual.

Visual Studio 2015 Light Bulb

If you hover your mouse cursor over this error, a light bulb will be displayed (on the line that generated the error) that will show you potential fixes to the issues Visual Studio 2015 highlighted in your code.

Visual Studio 2015 Light Bulb

You can click on the light bulb or you can use the shortcut (Crtl + .) to see the available fixes.

Visual Studio 2015 Light Bulb

Visual Studio 2015 Light Bulbs offer various fixes in the example above such as importing the correct namespace,  changing the line of code to the full qualifier by putting the namespace in front of the Thread method, as well as several other suggestions. Another nice addition to the light bulb suggestion is the code sample preview included to the right of the suggested fix.

As a new productivity feature in Visual Studio 2015, light bulbs make for an excellent way to keep developers writing correct code by bringing the suggested fix or refactoring into a single focal point directly on the line the error is on.

For more information check out the MSDN article here and see the Channel 9 video below. Mark Wilson Thomas discusses how Visual Studio 2015 assists developers to find and remove common coding mistakes on the fly.

Dirk Strauss
Dirk is a Software Developer and Microsoft MVP from South Africa. He loves all things Technology and is slightly addicted to Twitter and Jimi Hendrix. Apart from writing code, he also enjoys writing human readable articles. "I love sharing knowledge and connecting with people from around the world. It's the diversity that makes life so beautiful." Dirk feels very strongly that pizza is simply not complete without Tabasco, that you can never have too much garlic, and that cooking the perfect steak is an art he has yet to master.

Similar Articles

Top