This project has moved. For the latest updates, please go here.

Feel that Path.DirectoryName should return folder name only

Sep 5, 2010 at 11:30 AM


Currently, Path.DirectoryName returns the full path to the Directory (which is what the System.IO equivalent would do as well).

But, to be really useful, this property should return only the folder name. There are always other ways to retrieve the full directory path but, no way to retrieve the folder name only other than to use string ops.


C:\My Documents\  should return "My Documents"

C:\ should return empty string

Sep 14, 2010 at 7:13 PM

Yeah, I'd like to be consistent with the System.IO behavior as much as possible although I do agree to some extent. I'd advise you stay clear of that one that is indeed a little ambiguous and use FullPath and FileName depending on what you're trying to do.