They both do the same thing, but its interesting that Debug.Print will only take a string, while Debug.WriteLine will accept an object which ends up calling the object’s ToString method.
With Reflector:
[Conditional("DEBUG")]
public static void Print(string message){
TraceInternal.WriteLine(message);
}
[Conditional("DEBUG")]
public static void WriteLine(string message){
TraceInternal.WriteLine(message);
}
[Conditional("DEBUG")]
public static void WriteLine(object value)
{
TraceInternal.WriteLine(value);
}
I’d be willing to bet that Debug.Print was a hold over from Visual Basic.
Edit: From a tutorial on Tracing VB.NET Windows Application:
In Visual Basic.NET 2005, the
Debug.Write, Debug.WriteIf,
Debug.WriteLine, and Debug.WriteLineIf
methods have been replaced with the
Debug.Print method that was available
in earlier versions of Visual Basic.
Sure sounds like Debug.Print was a hold over from pre-C# days.