Debug Messages

Often there are times that you would like to display a message to a developer only informing them of some important aspect that your code is doing. In the past i’ve relied on Console.WriteLine and MessageBox.Show to help me debug my apps, but theres always a change that the end user will see something they shouldn’t. Recently when trying to debug a WCF Service i was wondering if i could write a message to the Output window in Visual Studio, it turns out you can.

Using the System.Diagnostics.Debug class you can write a message to the output window, the great thing about this is that it only executes when running your application in Debug Mode.

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: