string path1 = "C:\\Users\\MyUser\\Documents"; string path2 = "MyFile.txt"; string result = Path.Combine(path1, path2);
string[] paths = {"C:\\Program Files", "MyApp", "Images", "Logo.png"}; string result = Path.Combine(paths);This combines all four file path components to give the full file path, "C:\Program Files\MyApp\Images\Logo.png". The FilePath.Combine method is part of the System.IO namespace, which is included in the .NET Framework and Core libraries.