I am using fs.Length
, where fs
is a FileStream
.
Is this an O(1)
operation? I would think this would just read from the properties of the file, as opposed to going through the file to find when the seek position has reached the end. The file I am trying to find the length of could easily range from 1 MB to 4-5 GB.
However I noticed that there is a FileInfo
class, which also has a Length
property.
Do both of these Length
properties theoretically take the same amount of time? Or does is fs.Length
slower because it must open the FileStream
first?