Debug.WriteLine Method
.NET Framework 4
Writes information about the debug to the trace listeners in the Listeners collection.
This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.
| Name | Description | |
|---|---|---|
|
WriteLine(Object) | Writes the value of the object's ToString method to the trace listeners in the Listeners collection. |
|
WriteLine(String) | Writes a message followed by a line terminator to the trace listeners in the Listeners collection. |
|
WriteLine(Object, String) | Writes a category name and the value of the object's ToString method to the trace listeners in the Listeners collection. |
|
WriteLine(String, Object[]) | Writes a formatted message followed by a line terminator to the trace listeners in the Listeners collection. |
|
WriteLine(String, String) | Writes a category name and message to the trace listeners in the Listeners collection. |
Beware new formatted debug output
The new formatted API for .NET4:
Debug.WriteLine(stringFormat, intValue);
works as expected but may lead to a false sense of security that:
Debug.WriteLine(stringFormat, stringValue);
will also work but this instead calls one of the legacy overloads instead.
To work around this issue, cast the stringValue argument to an object or ensure there are at least two format arguments, adding e.g. null if necessary.
- 2/18/2011
- Rick Sladkey
- 2/18/2011
- Rick Sladkey