简体   繁体   中英

What's the equivalent of System.out.println() in C#/Silverlight?

I am developing some projects in C# and Silverlight.

I am trying to print lines of code in order to debug, but Console.Write() doesn't seem to work.

I've created a Silverlight Application, not a Console Application where Console.Write() did work. How can I print in a console or in the output window in a Silverlight Application project?

Use System.Diagnostics.Debug.Write to print in the debug output window.

See http://msdn.microsoft.com/en-us/library/system.diagnostics.debug.write.aspx

Using System.Diagnostics.Debug.WriteLine(); like Fox32 and VoodooChild mentioned did not work for me initially. Apparently my debugging wasn't working at all (breakpoints did not hit for example).

I was able to fix the debugging by using IE instead of FireFox (see Debugging Silverlight not hitting breakpoints )

As soon as that was fixed, the System.Diagnostics.Debug.WriteLine(); worked perfectly :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM