i




 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the difference between Write() and WriteLine() methods?
10-05-2010, 04:38 AM (This post was last modified: 10-05-2010 08:59 AM by Sulekha Kaul.)
Post: #1
What is the difference between Write() and WriteLine() methods?
Write()
Quote:1: Write() method outputs one or more values to the screen
without a newline character

WriteLine()
Quote:1: WriteLine() method outputs one or more values to the screen with a newline character


***Program that uses Console.Write (C#) ***
Code:
using System;

class Program
{
    static void Main()
    {
        Console.Write("Box");     // <-- This writes the word only.
        Console.Write("Circle");     // <-- This is on the same line.
        Console.Write("Rectangle");    // <-- Also on the same line.
        Console.WriteLine();       // <-- This writes a newline.

        Console.WriteLine("Triangle"); // <-- This is on the next line.
    }
}

=== Output of the program ===

Box Circle Rectangle
Triangle


Quote
10-05-2010, 07:22 AM
Post: #2
RE: What is the difference between Write() and WriteLine() methods?
Useful post but add one simple example.

Please give reputation if my answer/post is useful for you
Best Regards
Arti Gupta
Quote
10-05-2010, 08:28 AM
Post: #3
RE: What is the difference between Write() and WriteLine() methods?
Nice

But you are missing examples here
Smile

Cheers!!!!!!
Rajesh Kumar Parbat
Quote


Possibly Related Threads...
Thread: Author Replies Views: Last Post
  Difference between Finalize() and Dispose() methods in .NET umarali1981 0 2,363 08-19-2012 04:39 AM
Last Post: umarali1981
  Difference between Read() and ReadLine() methods? Chanpreet Singh 1 4,609 06-22-2012 01:01 PM
Last Post: gopesh9
  What is the difference between Read() and ReadLine() methods? Sulekha Kaul 5 7,798 10-05-2010 11:16 AM
Last Post: Usman
  Define different execute methods of ADO.NET command object ? Sulekha Kaul 0 2,922 10-05-2010 05:17 AM
Last Post: Sulekha Kaul



User(s) browsing this thread: 1 Guest(s)