470,561 Members | 1,617 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,561 developers. It's quick & easy.

Question about Console Write() & WriteLine() methods

It seems that there is basically no difference between the Console.Write() &
String.Format(), other than the output being sent to the console output stream
instead of a string. Is this accurate?

String formatter = "(whatever)";

Console.Write(formatter,object1,object2, ... );

String formattedString = String.Format(formatter,object1,object2, ... );

// Basically, formattedString will be exactly the same as what was put to the

Also, is there any difference between Write() & WriteLine(), other than a new

String thankU = "Thanks";

Jul 21 '05 #1
2 2367

I believe String.Format is mainly for backwards compatibility (or rather
for people familiar with String.Format to begin with) as assembling
complex strings in .net can be done by simple string concatenation and
ToString() in a more readable manner.

And no, WriteLine adds a linebreak at the end, otherwise they are the same.
Happy Coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #2
Yes. That's accurate.

Console.Write/Line make use of String.Format internally to format the

Gaurav Vaish

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bor de Wolf | last post: by
5 posts views Thread by Patrick De Ridder | last post: by
2 posts views Thread by Unemployed VC++ guy | last post: by
4 posts views Thread by ^MisterJingo^ | last post: by
20 posts views Thread by David | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.