To find out the length of a file (in bytes) you would normally use FileInfo.Length
or System.IO.Stream.Length
(is there a difference?). Both are of type long, i.e. System.Int64, hence the maximal possible value is:
9 223 372 036 854 775 807
Now it seems some filesystems, such as NTFS5 or Microsoft's Resilient File System (ReFS) theoretically allow a maximum file size that exceeds the Int64 range - according to this source, ReFS limits maximal file size to 2^64-1 bytes, which equals to (for readability purposes):
18 446 744 073 709 551 615
How would one go about determining file size in such case - however hypothetical it may be - and would it impact normal Stream operations (such as using Read/Write methods etc.)?
How would one go about determining file size in such case
There's nothing built-in to the .NET framework. When your file gets bigger, both FileInfo.Length
and System.IO.Stream.Length
will throw an exception. You will have to fall back to calling the Windows API directly (if the Windows API supports this currently).