[C#]String.Concat 方法

  • 5408
  • 0
  • C#
  • 2012-10-16

String.Concat 方法

String.Concat 方法 的功能是 串連指定 String 陣列中的元素。

以前都不知道有這個方法可以用,希望以後會有機會派上用場。

以下是個簡單的範例

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
              string[] empnames = 
            {"龍龍一 ",
             "龍龍二 ",
             "龍龍三 ",
             "龍龍四 ",
             "龍龍五 ",
             "龍龍六 ", 
              }; 
            Console.WriteLine(string.Concat(empnames));
            Console.Read();
        }
    }
}

如有錯誤 歡迎指正