-
Console Writeline
The most easiest thing in C# I guess, but I don't get it.
I'm new, you don't say...
If I make a new ASP.NET Website in Visual Studio 2005,
how can I make a simple line 'System.Console.Writeline("I don't get it");' work?
Code:
using System;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Console.WriteLine("I don't get it");
}
}
The website opens but I don't see a written line 'I don't get it'.
Can anyone please help me, I want to practise C#, but if I can't make this work, what else...
-
Re: Console Writeline
If you write to the console, it shows up in the console, not in the web response.
You can do this:
Code:
Response.Write("I don't get it either.");
But it's bad form, and I only tell you exists so that you can avoid it. You should use controls to display any and all output to the page itself.
-
Re: Console Writeline
What is a console?
Thanks for the reply, anyway!
Now I can practice some more.
-
1 Attachment(s)
Re: Console Writeline
Unless you really need to make web apps, I suggest you practice C# by making console applications. This spares you the burden of having to worry about a GUI of any sort.
-
Re: Console Writeline
Penagate,
As on your above post(#4), it is able to hold the Console/Command prompt. Or is it just flash.
It is better to add following code line after the line
Code:
Console.WriteLine("text");
My suggestion code ie,
Code:
Console.ReadLine();
What is your thought on my suggestion.
-
Re: Console Writeline
No, just pick Run Without Debugging instead of Run and it'll keep the console open automatically. Console applications should not stay open by themselves.
-
Re: Console Writeline
True. But it is easy to use ctrl+F5.
Then Debugging.