NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Directory.Combine

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;

Parameters

path1
The first path.
path2
The second path.

Return Value

A string containing the combined paths. The strings are trimmed to remove the leading and trailing whitespaces.

Exceptions

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.

Remarks

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.

Requirements

NGWS Runtime Security:

FileIOPermissionAccess Read and write permission to the paths to be combined.

See Also

Directory Class | Directory Members | System.IO Namespace