Debug WritLine Oddity

  • Thread starter Thread starter John A. Bailo
  • Start date Start date
J

John A. Bailo

When I run this line,

Debug.WriteLine("I am in OnHandler2 and MyEventArgs is {0}", e.m_id);

and e.m_id = "Event args for event 1"

What prints in the debug window is:

Event args for event 1: I am in OnHandler1 and MyEventArgs is {0}



Why?
 
I don't think Debug.Writeline has that overloaded method...

Debug.Writeline(format as string, arg0 as Object) ' doesn't exist does it?

I think you are actually calling Debug.Writeline(message as string, category
as string)

Unlike,
Console.Writeline(format as string, arg0 as Object)

I am never quite sure when and where I can use {0} either.

Greg
 
Debug.WriteLine(message, category). The value of "category" was not
printed.
To format, use Debug.WriteLine(String.Format(message, params));

If it is a console app, you might want to use Console.WriteLine instead?
 
Back
Top