How to combines an array of strings into a path in C#

1 Answer

0 votes
using System;
using System.IO;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = { @"d:\software", "projects", "r2d2", "connections" };

            string path = Path.Combine(s);

            Console.WriteLine(path);
        }
    }
}


/*
run:
  
d:\software\projects\r2d2\connections

*/

 



answered Aug 17, 2018 by avibootz

Related questions

...