Combines two file paths.
[Visual Basic] Public Shared Function Combine( _ ByVal path1 As String, _ ByVal path2 As String _ ) As String [C#] public static string Combine( string path1, string path2 ); [C++] public: static String* Combine( String* path1, String* path2 ); [JScript] public static function Combine( path1 : String, path2 : String ) : String;
A string containing the combined paths. The strings are trimmed to remove the leading and trailing whitespaces.
Exception Type | Condition |
---|---|
ArgumentNullException | path1 or path2 is a null reference (in Visual Basic Nothing). |
ArgumentException | path2 is an empty string ("") or IsDirectoryRooted is true. |
SecurityException | The caller does not have the required permission. |
If path2 does not include a root (for example, if path2
does not start with a backslash (\) or a drive specification), the result is a concatenation of the two paths, with an intervening backslash if required. If path2 includes a root, the result is path2. If either path1 or path2 is null, the result is a non-null string. If both path1 and path2 are null, the result is null.
NGWS Runtime Security:
FileIOPermissionAccess | Read and write permission to the paths to be combined. |