Path.Combine Method (String, String, String)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

When it is called by trusted applications, combines four strings into a path.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared Function Combine ( _
    path1 As String, _
    path2 As String, _
    path3 As String _
) As String
public static string Combine(
    string path1,
    string path2,
    string path3
)

Parameters

Return Value

Type: System.String
A string that contains the combined paths.

Exceptions

Exception Condition
ArgumentException

path1, path2, path3, or path4 contains one or more of the invalid characters defined in GetInvalidPathChars.

ArgumentNullException

path1, path2, path3, or path4 is nulla null reference (Nothing in Visual Basic).

Remarks

path1 should be an absolute path.If one of the subsequent paths is also an absolute path, the combine operation discards all previously combined paths and resets to that absolute path.

Zero-length strings are omitted from the combined path.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.