문제

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top