RemotePath.GetDirectoryName Method

Returns the directory information for the specified remote/*nix path string.

Syntax

C#
public static string GetDirectoryName(string path)
VB.NET
Public Shared Function GetDirectoryName(path As String) As String

Parameters

Name Description
string path Path to retrieve directory information from.

Return Value

Directory information for path, or null if path denotes a root directory or is null.

Exceptions

Exception Condition
ArgumentException path is empty.1

Remarks

In most cases, the string returned by this method consists of all characters in the path up to but not including the last slash (/).

The method is an equivalent of the standard Path.GetDirectoryName method for remote/*nix paths.

  1. Note that this behaviour is inconsistent with Path.GetDirectoryName in .NET Core 2.1 and newer, which instead returns null.Back

Last modified: by martin