문자열 선언 및 요소 추가 -
string[] str = { "One", "Two", "Three", "Four", "Five" }; Join() 메서드를 사용하여 단어를 결합하십시오-
string res = string.Join(" ", str); 전체 코드를 보자 -
예시
using System;
public class Demo {
public static void Main() {
string[] str = { "One", "Two", "Three", "Four", "Five" };
// join words
string res = string.Join(" ", str);
Console.WriteLine(res);
}
} 출력
One Two Three Four Five