C#中Write()和WriteLine()的区别分析

  using System;

  using System.Collections.Generic;

  using System.Linq;

  using System.Text;

  using System.Threading.Tasks;

  namespace WriteLine和Write的区别

  {

  class Program

  {

  static void Main(string[] args)

  {

  //WriteLine输出后鼠标显示在下一行开头

  //Write输出后不开始一个新行

  System.Console.WriteLine("First WriteLine Line");

  System.Console.WriteLine("Second WriteLine Line");

  System.Console.Write("First Write Line");//First Write Line后面不开始新的一行,直接紧跟着输出Second Write Line

  System.Console.Write("Second Write Line");

  //passing parameters

  System.Console.WriteLine("

  WriteLine:Parameter={0}", 123);

  System.Console.Write("Write:Parameter={0}", 456);

  System.Console.ReadKey();

  }

  }

  }