Login(Email) Password Forgot Password Account Settings
Home ASP.net System Info C# Books Java Script Visual C++(MFC) C/C++ Win API Java Contact Us
Path class Combine Method (Visual Studio 2008 C#)
Combines a path with a file name or a subdirectory (How to combine the path in visual studio 2008 using C#)
Syntax:
public static string Combine(
    string path1,
    string path2
)

Example:

public class CombineMethod {

    public static void Main() {

        string path1 = "c:\\temp";
        string path2 = "subdir\\file.txt";
        string path3 = "c:\\temp.txt";
         
        string combination = Path.Combine(path1,path2);    
// combination variable will contain path like that c:\temp\subdir\file.txt
string combination1 =Path.Combine(path1,path3);
          // combination1 variable will contain path like that c:\temp\file.txt
         }
            }