반응형

C# Console 프로그램을 하면 문자들을 출력하는 2개의 함수를 볼 수 있습니다. C# 콘솔에서 가장 많이 쓰이는 함수들이죠.


Write 와 WriteLine 함수의 차이점을 간단히 이야기를 하면

Write와 WriteLine 함수는 괄호 안에 있는 문자열을 화면에 출력을 해 줍니다. 하지만 WriteLine은 문자열 뒤에 

뉴라인(NewLine)문자를 추가합니다. 


Test Example

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

        {

            Console.Write("Hello,");

            Console.Write("My Name Is HongGilDong");

            Console.WriteLine("and...");

            Console.Write("Goodbye");

            Console.WriteLine(".");

        }

    }

}

 


Result



실행 결과는 다음과 같습니다. 이제 차이점을 아시겠죠?


반응형

'프로그래밍 > Language C#' 카테고리의 다른 글

[C#] System.Security.SecurityException Window Serveice 등록시 Install Error  (0) 2013.07.23
[C#] Serial Port, DiscardInBuffer  (0) 2013.07.18
[C#] DB 연동  (0) 2011.12.23
[C#] Thread 실습  (0) 2011.11.17
[C#] Thread 생성  (0) 2011.11.16