I want to give nice name to my function while returns drive, directory and file. Can you please suggest a good abstract name for this trio?

This is the function.

  static IEnumerable<string> GetDriveDirectoriesAndFile(string path)
     if (path.Contains('/'))
        path = path.Replace('/', '\\');
     if (path.Contains('\\'))
        return path.Split('\\');
     return null;

Thanks, Omkar

closed as primarily opinion-based by durron597, user40980, gnat, Ixrec, user22815 Aug 29 '15 at 22:50

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    will it return the whole thing at once, like on windows "C:/programs/something"? This would mostly be called a file_path. – thorsten müller Apr 3 '12 at 14:50
  • It takes path and return IEnumerable<string> which contains C:,programs,something.txt like that.. thanks – om471987 Apr 3 '12 at 14:51
  • 1
    How about "FileSystemObjects"? It's the only term I can think of that covers them all. – FrustratedWithFormsDesigner Apr 3 '12 at 14:54
  • AbstractNamingPathVisitorAdapterContext - sorry, I had to poke fun at the over-sophisticated names that come from overuse of design patterns. Path element, path part or path component are all fine. – Brandon Jun 2 '14 at 0:47

Since it looks like you are using .NET, if possible I would suggest using the terminology in the System.IO.Path class:

  • Root (Drive letter such as C:\ or UNC such as \server\share)
  • Directory Name
  • File Name

Also, if possible, I would suggest using the Path, FileInfo, and DirectoryInfo classes when working with file system paths, rather then attempting to do the splitting, combining, and parsing on your own.

  • Bingo... Exactly what looking for... In control systems such solutions are called feed Forward systems.... – om471987 Apr 3 '12 at 17:51

How about calling your method GetPathComponents(string path)?

  • 1
    +1 - Components is better than my suggestion – ozz Apr 3 '12 at 15:04
  • File itself cannot be a component of path. These all can be categorized under file system objects... FileSystemObject is closer to the correct nam right now for me.. – om471987 Apr 3 '12 at 15:05
  • 1
    @Omkar panhalkar: I disagree (see this article). However, use whatever you prefer. :) – Bernard Apr 3 '12 at 15:16

I'm going to suggest "FileSystemObjects", Or if you want to shorten it: "FSObjects", or "FSOs", or some variant of that.

  • Thanks frustrated person...LOL... Thanks a lot.. I decided to go with GetFileSystemObjects... :) – om471987 Apr 3 '12 at 15:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.