File method and property names

Several APIs that I have worked with deal with the file system in some form or fashion.  However there does not seem to be any sense of unity with respect to property and method names when it comes to the display form returned or processed.

The two most common forms of file representations that I have encountered are the file name and the full path of the file.  It is usually unclear from the property or method name, which it is returning.  A lot of places where they return the full path of the file have the property name such as FileName.  For me that is counter intuitive and there should be an easy way to tell without having to look up the API every time. 

The best representation that I have come across is the following

   FileName – Returns just the name of the file

   FilePath – Returns the full path of the file including the file name

Comments (2)

  1. Harry says:

    What would you name just the Path (without the FileName)? Are there any other parts of a Path or FilePath which should be "standards" (Drive letter, Uri-Protocol (file://…). We should comeup with a list of this and use it within MS and the community. Why not have a dedicated place on MSDN where this stuff is published?

    Cheers Harry

  2. Mark says:

    Given a consistent FileName/FilePath property, they can be easily massaged with the IO.Path static methods to get whatever part you’re looking for. eg., IO.Path.GetFullPath(a.FilePath) would return just the path.