views:

32

answers:

2

I'm trying to understand how File attributes such as the Created and Modified dates relate to a System.IO.Stream or System.IO.FileStream to the file. Are these attributes contained in the stream, or is the data part of the file that is read by the Stream separate from the file attributes?

A: 

File attributes are not part of file's content. They are implemented differently by different file systems, and the OS provides API for working with them.

Fyodor Soikin
+1  A: 

The separation goes all the way back to the disk, the metadata for a file is stored in a distinct location from the file data. A "directory entry" in Windows. It is otherwise the job of the operating system to maintain this data. Those dates are automatically updated when you create or write the file. Read them back in a program with the FileInfo class.

Hans Passant