Show / Hide Table of Contents

Method Path2.Join


Overload

Concatenates two path parts using character '\\'. For example directory path and file name.

public static string Join(string s1, string s2, bool s2CanBeFullPath = false, bool prefixLongPath = true)
Parameters
s1  (string)

First part. Usually a directory. Can optionally end with a directory separator character. Cannot be null/empty.

s2  (string)

Second part. Usually a filename or relative path.

s2CanBeFullPath  (bool)

If s2 is full path, return s2.

prefixLongPath  (bool)

Call Path2.PrefixLongPathIfNeed which may prepend @"\\?\" if the result path is very long. Default true.

Returns
string
Exceptions
ArgumentException

s1 is null or empty.

Remarks

Calls System.IO.Path.Join, unless s2CanBeFullPath true and s2 is full path.

With default values of s2CanBeFullPath and prefixLongPath, this method is the same as the string extension operator /.

See Also

Path2.Normalize