Hi,
In my C# .net application.
Console.WriteLine("Now let us begin!");
However, the string, "Now let us begin!", never shows up in the "View"-
Anyone can advise me on how to get the text show in the output?
Hi,
In my C# .net application.
Console.WriteLine("Now let us begin!");
However, the string, "Now let us begin!", never shows up in the "View"-
Anyone can advise me on how to get the text show in the output?
Well I must say Use
Console.ReadLine();
At the end.
well its usually used when you use the emlator. The results go to a console window on your dekstop ahh here is an example
http://www.codeproject.com/csharp/compacttcptrace.asp
It goes to the output tab of that little window that also contains the task list. Depending on what you're writing there, you might have to hunt for it because Visual Studio writes its own stuff there, too.
In case of ASP.NET
So let me rephrase your question to something analogous:
When a tree falls in the woods does it makes a sound. The answer is, of course, "yes". But that doesn't help you since you already knew the answer. The real question is: "Is anyone listening?".
So, back to your Console question. The answer is yes, the Console API is working (it's making a sound) but nobody's listening. IOW, no one's capturing the console output.
Another option that you might consider is using the Trace APIs. Instead of Console.Write, try Trace.Write or Trace.Warn. For these APIs, somebody *is* listening as long as you enable tracing in your page by setting <%@ Page Trace=true%>. You can also set this application-wide in web.config, but then to see the trace info you'll have to browse to trace.axd.
Bookmarks