Write, WriteLine

From C# Online.NET (CSharp-Online.NET)—your free C# and .NET encyclopedia


Jump to: navigation, search
CSharp-Online.NET:Tutorials
C# Tutorials
Testing and Debugging
edit

By default the messages passed to these methods are displayed in the 'Output' window.

The Output window can be shown via the shortcut ('Ctrl'+'W'),('O')

Example

using System;
using System.Windows.Forms;
using System.Diagnostics;
 
namespace debugTesting {
 
  public partial class Form1 : Form {
 
    public Form1() {
 
      InitializeComponent();
    }
 
    private void debugWrite_Click(object sender, EventArgs e) {
 
      int importantVariable = 4;
 
      Debug.WriteLine("debugWrite_Click()");
 
      for (int i = 0; i < importantVariable; i++) {
        Debug.Write(i);
        Debug.Write(" ");        
      }
    }
  }
}

Result

Image:write.gif


Personal tools
C# Entry Points