Return code or out parameter?

Viewed 813

I'm making a method to fetch a list of filenames from a server but I have come to a problem that I cannot answer.

The method returns two things:

  • an SftpResult which is an enum with a variety of return codes.
  • the list of filenames.

Of these three signatures:

public static ArrayList GetFileList(string directory, out SftpResult result)

public static SftpResult GetFileList(string directory, out ArrayList fileNames)

public static SftpFileListResult GetFileList(string directory)

(where SftpFileListResult is a composite object of an SftpResult and an ArrayList)

which is preferred and why?

7 Answers
Related