Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert code snippet for Debug.WriteLine(); in Visual Studio?

I can simply insert code snippet for the Console.WriteLine(); by just using the cw
with Tab + Tab. But I'm not able to find the same option for the Debug.WriteLine();.

I want to know how can we customize the code snippet template in Visual Studio for Windows Phone?

like image 539
Vikas Patidar Avatar asked Mar 23 '12 12:03

Vikas Patidar


People also ask

How do I add a snippet to Visual Studio?

On the menu bar, choose Edit > IntelliSense > Insert Snippet. From the right-click or context menu in the code editor, choose Snippet > Insert Snippet.

How do I enable debug WriteLine?

WriteLine calls may not display in the output window if you have the Visual Studio option "Redirect all Output Window text to the Immediate Window" checked under the menu Tools → Options → Debugging → General. To display "Tools → Options → Debugging", check the box next to "Tools → Options → Show All Settings".

Where does debug WriteLine write to?

By default, the output is written to an instance of DefaultTraceListener. This method calls the WriteLine method of the trace listener.


1 Answers

In Visual Studio 2010 (and assuming other versions as well), there is not a snippet for Debug.WriteLine(). In that case, you'll need to create a custom snippet. Fortunately, it isn't that hard with the available resources:

  • MSDN: Creating and Using IntelliSense Code Snippets
  • The Snippet Editor
  • Snippet Designer (Visual Studio Extension) and the related CodePlex Site

If you're using ReSharper, then Code Templates and specifically Live Templates are a quick and easy option.

like image 64
Metro Smurf Avatar answered Sep 22 '22 18:09

Metro Smurf