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

1 answer 170 views
1 answer 180 views
2 answers 113 views
113 views asked Jul 13, 2023 by avibootz
3 answers 188 views
2 answers 174 views
...