参数数组

        static void Main()
        {
            Console.WriteLine(Combine("test:\\", "abc", @"\def"));
            Console.WriteLine(Combine(new string[]{"abc"," def" ," g"}));
            Console.ReadKey();
        }

        static string Combine(params string[] paths)
        {
            var result = new StringBuilder();
            foreach (var path  in paths)
            {
                result.Append(path);
            }
            return result.ToString();
        }

  

posted on 2018-04-12 10:01  不会非的猪  阅读(113)  评论(0编辑  收藏  举报

导航