This discussion was split from this thread.
I agree that you should get out there and experiement. You can't break the computer unless you're deleting files or something (and then it would only be if you're deleting system files which the OS should prevent you from doing anyway). Try it. Watch it blow up. Then ask why it blew up or did something other than what you expected.
But you also shouldn't be afraid to ask questions here on the forum.
To everyone pointing to MSDN: You can't be serious. MSDN is near worthless. I use it all the time to get a list of methods and whatnot. But for explaining how things work, ALL Microsoft documentation is absolutely worthless. It's a joke. It's one step up from no documentation at all.
The definition on MSDN for Write(string) is: "Writes the specified string value to the standard output stream." They almost might as well have just left it blank. That "pretty much" says absolutely nothing. But more importantly, it misses the critical difference between Write and WriteLine. First of all, an absolute beginner isn't even going to know what a stream is. Who is this written for? Their documentation is ALWAYS written for those who don't need the documentation. If you can tell everyone off the top of your head what the method does and how it works, then the documentation is written for you. Not that you need it, because you know it off the top of your head. For the people who need the documentation it has practically no useful information whatsoever at all.
Anyway, the primary difference between Write and WriteLine is that WriteLine "wraps" the cursor down to the next line. It has what they call a carriage return and line feed that goes back to the days when computers used punch cards for input and sent ALL of their output to a printer (no such thing as a computer monitor back then). These printers had wheels that pushed the paper forward. So, you had to explicately tell the printer to push the paper forward at the end of each line. This was called a "line feed"(vertically). Then you had to tell the printer to move the print head back to the beginning of the line (horizontally). This was called a "carriage return" with the "carriage" being the print head that returned back to the beginning of the line.
Somehow, this has managed to stick around in computing even today. Some systems will move down to the next line with just one or the other and some still require both the carriage return and the linefeed command to be sent.
I believe you can get the same effect by putting a '\n' in your string in order to send it to the next line (or is it '/n', I forget).
Anyway, the difference between Write and WriteLine is that WriteLine will move down to the next line o the screen when it writes what it's going to write. Write keeps the cursor right at the end of what you write without going down to the next line.
So, you may want to use Write to put something on a line and then another Write to put something else on the same line right after it. But it will never go down to that next line unless it runs off the end of the screen or you do a WriteLine.
In fact, you can do a Console.WriteLine() with no string given just to go down to the next line.
Oh. And that talk about terminators and output streams... an output stream is just where the text is sent to. Normally that's going to be your screen. But it could be a file on the harddrive or other device. The "terminator" is the carriage return and line feed I was telling you about, but for some devices the terminator might be different.
This post has been edited by Curtis Rutland: 25 October 2012 - 11:34 AM

New Topic/Question
Reply


MultiQuote










|