Introducing Bing Code Search, an easy way to find code samples from within Visual Studio 2013

Time is valuable and sometimes taking the time to open up a new browser tab to search for an example of code to do something can be a pain (because we can also be lazy).

Thankfully, Microsoft’s Language Experience team created a product just for you: Bing Code Search.

What Does It Do?

Released just this month as an extension for non-Express editions of Visual Studio 2013, Bing Code Search presents some very cool and useful features, which may be especially useful for experienced developers that need a quicker method of accessing examples and resources and for new developers still trying to figure out the code they need to accomplish tasks like reading files or iterating through collections.

After installing the extension in Visual Studio, you’ll see a small Bing logo above the native Visual Studio Intellisense. This will allow you to search for and use code examples and snippets from sites like Stack Overflow, MSDN and more without ever leaving your development environment or dragging an open browser onto another monitor :

Performing a Code Search for Examples

What is going on here?


Just kidding, but in as with most recent Microsoft innovations in the realm of development, the Roslyn compiler is involved (which is a bit magical). Basically, when you begin your search, your specific query is sent up to Bing along with several other important contextual pieces of information related to your project (such as the Project type, contextual keywords and other goodies) and then it returns a filtered and ranked set of results that might best match the code example you are looking for.

Since there isn’t a holy grail website containing all of the latest a greatest code examples, the code search will actually scour a multitude of different Q/A sites along with some other documentation and resources and compile a listing of relevant code examples that the developer can easily use either for documentation or to copy-paste directly into their project.

How Do I Use It?

The Bing Code Search extension is currently only available for Visual Studio 2013 (non-Express editions) and can be easily downloaded and installed from the Visual Studio gallery at link provided below :

If you don’t have Visual Studio 2013 or you just want to get an idea of how the service works, you can access a fully working example running below at Microsoft Research’s CodeSnippet area :

Try it out.

As a free tool that is incredibly easy to use, I would highly recommend giving it a shot if you have a non-Express edition of Visual Studio 2013 installed. It’s still a very early product and will likely continue to improve in the future (hopefully expanding to non-Express editions as well as earlier versions of Visual Studio), but it may be a great tool to consider adding to your development arsenal either as a time-saver if you are an experienced developer or as an excellent learning tool for those just diving into the development world.