FileSystemProxy.CombinePath(String, String) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Combines two paths and returns a properly formatted path.
public:
System::String ^ CombinePath(System::String ^ baseDirectory, System::String ^ relativePath);
public string CombinePath(string baseDirectory, string relativePath);
member this.CombinePath : string * string -> string
Public Function CombinePath (baseDirectory As String, relativePath As String) As String
- baseDirectory
- String
String
. First path to be combined.
- relativePath
- String
String
. Second path to be combined.
The combination of the specified paths.
baseDirectory
or relativePath
are malformed paths.
This example combines a directory path and file name to create a properly formatted path.
Dim fullPath = My.Computer.FileSystem.CombinePath(
"C:\Documents and Settings\All Users\Documents\My Pictures", "picture.jpg")
This example combines two paths to create a properly formatted path.
Dim fullPath = My.Computer.FileSystem.CombinePath(
"C:\Dir1\Dir2\Dir3", "..\Dir4\Dir5\File.txt")
This example returns C:\Dir1\Dir2\Dir4\Dir5\File.txt
.
This method trims excess slash-mark characters to create a properly formatted path.
The following table lists examples of tasks involving the My.Computer.FileSystem.CombinePath
method.
To | See |
---|---|
Combine a directory path and file name | How to: Parse File Paths |
Produkt | Versioner |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 5, 6, 7, 8, 9, 10 |
Feedback om .NET
.NET är ett öppen källkod projekt. Välj en länk för att ge feedback: