Questions tagged [console.writeline]

Writes the specified data, followed by the current line terminator, to the standard output stream.

Writes the specified data, followed by the current line terminator, to the standard output stream.

253 questions
381
votes
14 answers

Where does Console.WriteLine go in ASP.NET?

In a J2EE application (like one running in WebSphere), when I use System.out.println(), my text goes to standard out, which is mapped to a file by the WebSphere admin console. In an ASP.NET application (like one running in IIS), where does the…
Kevin Hakanson
  • 41,386
  • 23
  • 126
  • 155
63
votes
8 answers

Is there a way to delete a character that has just been written using Console.WriteLine?

Is there any way to delete the last character from the console, i.e. Console.WriteLine("List: apple,pear,"); // Somehow delete the last ',' character from the console. Console.WriteLine("."); // Now the console contains "List: apple,pear." Sure, I…
Contango
  • 76,540
  • 58
  • 260
  • 305
60
votes
4 answers

Calling Console.WriteLine from multiple threads

Why does Console.WriteLine work from multiple threads?
user113476
48
votes
1 answer

Is console.writeline thread safe?

Possible Duplicate: Calling Console.WriteLine from multiple threads Just want to know if multiple threads call Console.WriteLine, will it cause a deadlock?
user496949
  • 83,087
  • 147
  • 309
  • 426
45
votes
2 answers

What is the rounding rule when the last digit is 5 in .NET?

Here is my code: using static System.Console; namespace ConsoleApp2 { internal class Program { static void Main(string[] args) { double[] doubles = new[] { 9.05, 9.15, 9.25, 9.35, 9.45, 9.55, 9.65, 9.75, 9.85,…
obnews
  • 602
  • 5
  • 13
38
votes
4 answers

Redirecting Console.WriteLine() to Textbox

I'm building this application in Visual Studio 2010 using C#. Basically there are 2 files, form1.cs (which is the windows form) and program.cs (where all the logic lies). //form1.cs public partial class Form1 : Form { //runButton_click…
sora0419
  • 2,308
  • 9
  • 39
  • 58
32
votes
10 answers

How can I write these variables into one line of code in C#?

I am new to C#, literally on page 50, and i am curious as to how to write these variables in one line of code: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace consoleHelloWorld { class Program …
Erik Grosskurth
  • 3,762
  • 5
  • 29
  • 44
22
votes
7 answers

C# clear Console last Item and replace new? Console Animation

The following CSharp Code(just sample): Console.WriteLine("Searching file in..."); foreach(var dir in DirList) { Console.WriteLine(dir); } Prints Output As: Searching file in... dir1 dir2 dir3 dir4 . . . Question? How can I get the…
PawanS
  • 7,033
  • 14
  • 43
  • 71
22
votes
7 answers

Why does Console.WriteLine() function miss some characters within a string?

I have a string, declared as: string text = "THIS IS LINE ONE "+(Char)(13)+" this is line 2"; And yet, When I write Console.WriteLine(text);, the output is: this is line 2E Why is this behaviour happening? Or is it because I'm being stupid and…
jbutler483
  • 24,074
  • 9
  • 92
  • 145
18
votes
3 answers

Console.Writeline basics

I have a question about the following code: class CurrentDate { static void Main() { Console.WriteLine(DateTime.Now); } } Documentation says: Writes the text representation of the specified array of…
CuriousGuy
  • 1,545
  • 3
  • 20
  • 42
13
votes
4 answers

How to print the same character many times with Console.WriteLine()

Possible Duplicate: Is there an easy way to return a string repeated X number of times? If I want to display a dot 10 times in Python, I could either use this: print ".........." or this print "." * 10 How do I use the second method in C#? I…
Alexander Popov
  • 23,073
  • 19
  • 91
  • 130
11
votes
4 answers

Infrequent hangs in a multi-threaded C# console application when using Console.Writeline() or Console.Write()

I have written a console application that makes use of console.write and console.writeline to provide some logging. The application is a server application that uses asynchronous beginacceptconnection() and beginread() ( Sockets ) for communication.…
11
votes
5 answers

(Console.BufferHeight) I can't see/scroll to see all the console output with Console.WriteLine

When I run this code, the number at the top of the output window is 99701. Why don't I get to see all the way through 1? I actually see all the numbers getting outputted, but on the console window, I can only SCROLL high enough to see 99701 (I'm…
Gordon Gustafson
  • 40,133
  • 25
  • 115
  • 157
9
votes
3 answers

What does Console.WriteLine() write to during release?

So I was wondering, when running a regular winforms application, where does the Console.WriteLine() method write to? I know that during debug it'll happily spit out all text in the debug output, but where does everything go when I'm no longer…
user2244255
9
votes
3 answers

c# attribute over main

Someone asked me a question as to how we can print line no 1 line no 2 line no 3 Without changing a main method which reads static void Main(string[] args) { Console.WriteLine("line no 2"); } Now one approach was to have multiple entry points…
1
2 3
16 17