Equivalent of console.log in C#

Trace.WriteLine will do (and probably more methods from the Trace class).

You can use a program called DebugView to real-time monitor the trace generated, or write to a log file using you web.config file.


Try using System.Diagnostics.Debug.WriteLine("This is a log"); and in Visual Studio open View and then in Output you will see the log when running your application.


Console.WriteLine will do it provided that you have a console to view it in (for a forms application this works when debugging in something like visual studio, but the end user will never see the output)

Tags:

C#