FilePath filePath = new FilePath("/Users/JohnDoe/Documents/Report.docx"); string fileName = filePath.GetName(); Console.WriteLine(fileName);
FilePath directoryPath = new FilePath("/Users/JohnDoe/Documents"); string directoryName = directoryPath.GetName(); Console.WriteLine(directoryName);This code will output "Documents" because it is the name of the directory represented by the FilePath object. The Sharpen FilePath.GetName() method is part of the Sharpen.File library.