Tutorial :Does a Stream from a file contain the source file's attributes?



Question:

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?


Solution:1

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.


Solution:2

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »