[Mono-dev] System.IO or Mono.Unix
jonpryor at vt.edu
Fri Dec 22 13:46:01 EST 2006
On Fri, 2006-12-22 at 17:49 +0000, Luciano _ wrote:
> First: I'm developing an application that use System.IO and i read that
> there are some IO operation classes in the Mono.Unix namespace. Which is the
> best solution? System.IO or Mono.Unix? I'm developing a Linux-Only
Use System.IO unless there is something you really need that only
Mono.Unix provides. This assures portability.
> Second: Could someone explain (example) how
> Mono.Unix.DirectoryInfo.GetEntries works?
By using readdir(3).
> i need to get all the
> directories/files/symbolic links and: length, datetime creation and
> modified, fullpath, etc. I don't understand how to use the returned value
> (Mono.Unix.Native.Dirent) and how to convert to UnixFileInfo or
Use Mono.Unix.UnixDirectoryInfo.GetFileSystemEntries() if you want a
UnixFileSystemInfo subtype returned for each file system entry. The
MOno.Unix.Native.Dirent is primarily useful for getting file system
entry names -- everything else is not necessarily portable between Unix
systems. You'd use GetEntries() if you wanted to avoid the extra
stat(2) call that constructing a UnixFileSystemInfo requires (in order
to get modification time, file permissions, etc.).
More information about the Mono-devel-list