In C#.Net, System.Diagnostics.Debug.WriteLine
has several overloads, including these two:
//http://msdn.microsoft.com/en-us/library/cc190153.aspx
public static void WriteLine(string format, params Object[] args);
//http://msdn.microsoft.com/en-us/library/1w33ay0x.aspx
public static void WriteLine(string message, string category);
My intention is to call the first one with:
Debug.WriteLine("The path is {0}", myObj.myPath);
But it appears that I'm actually calling the second overload, because it is a more exact match.
Is there a simple way to indicate that I want the first one?
My best attempts so far are:
Debug.WriteLine("The path is {0}", new object[]{myObj.myPath});
Debug.WriteLine("The path is {0}", myObj.myPath, "");
But neither of these looks very elegant.
Try this:
Debug.WriteLine("The path is {0}", (object)myObj.myPath);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With