The best VPN 2023

The Best VPS 2023

The Best C# Book

C# Path.GetDirectoryName method code example

Path.GetDirectoryName method code example
C# Path.GetDirectoryName method code example 4

C# Path.GetDirectoryName method code example. This article summarizes the typical usage code examples of the System.IO.Path.GetDirectoryName method in C#. If you are suffering from the following question: The specific usage of the C# Path.GetDirectoryName method? How to use C# Path.GetDirectoryName? C# Path.GetDirectoryName use example?

Congratulations, the method code examples selected here may help you. You can also learn more about the usage example of the class System.IO.Path where the method is located.

How to publish guest posts on znlive

Path.GetDirectoryName method code example

string filePath = @"C:\MyDir\MySubDir\";
string directoryName;
int i = 0;

while (filePath != null)
    directoryName = Path.GetDirectoryName(filePath);
    Console.WriteLine("GetDirectoryName('{0}') returns '{1}'",
        filePath, directoryName);
    filePath = directoryName;
    if (i == 1)
        filePath = directoryName + @"\";  // this will preserve the previous path

Path.GetDirectoryName method code example

Developer NET developer, project name: System.IO, code lines: 16, code source: Path.GetDirectoryName

GetDirectoryName('C:\MyDir\MySubDir\') returns 'C:\MyDir\MySubDir'
GetDirectoryName('C:\MyDir\MySubDir') returns 'C:\MyDir'
GetDirectoryName('C:\MyDir\') returns 'C:\MyDir'
GetDirectoryName('C:\MyDir') returns 'C:\'
GetDirectoryName('C:\') returns ''
publish guest posts on znlive

Leave a Comment