FileSystem.CombinePath(String, String) Method
Definition
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:
static System::String ^ CombinePath(System::String ^ baseDirectory, System::String ^ relativePath);
public static string CombinePath (string baseDirectory, string? relativePath);
public static string CombinePath (string baseDirectory, string relativePath);
static member CombinePath : string * string -> string
Public Shared Function CombinePath (baseDirectory As String, relativePath As String) As String
Parameters
- baseDirectory
- String
String
. First path to be combined.
- relativePath
- String
String
. Second path to be combined.
Returns
The combination of the specified paths.
Exceptions
baseDirectory
or relativePath
are malformed paths.
Examples
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
.
Remarks
This method trims excess slash-mark characters to create a properly formatted path.
The following table lists an example of a task involving the My.Computer.FileSystem.CombinePath
method.
To | See |
---|---|
Combine a directory path and file name | How to: Parse File Paths in Visual Basic |
Applies to
See also
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για