C# Path Combine(String[])
Description
Path Combine(String[])
Combines an array of strings
into a path.
Syntax
Path.Combine(String[])
has the following syntax.
public static string Combine(
params string[] paths
)
Parameters
Path.Combine(String[])
has the following parameters.
paths
- An array of parts of the path.
Returns
Path.Combine(String[])
method returns The combined paths.
Example
The following example combines an array of strings into a path.
//from w w w . j av a 2 s . co m
using System;
using System.IO;
public class MainClass
{
public static void Main(String[] argv)
{
string[] paths = { @"d:\archives", "2001", "a", "b" };
string fullPath = Path.Combine(paths);
Console.WriteLine(fullPath);
}
}
The code above generates the following result.