BinaryReader.Read dont support long values?

Steven Young 261 Reputation points
2021-06-26T21:52:01.917+00:00

I need to use BinaryReader.Read to read the file that more than 2GB (greater than the integer value range), the function parameters only support int32.

_BinaryReader.Read(_Buffer, 0, ChunkSize) 'ChunkSize value is 5GB (5,368,709,120), it's long value.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,589 questions
{count} votes

Accepted answer
  1. Sam of Simple Samples 5,516 Reputation points
    2021-06-27T17:34:36.37+00:00

    Can you use a Memory Mapped File? MemoryMappedFile Class says:

    Memory-mapped files enable programmers to work with extremely large files

    So that appears to be what Microsoft intends to be used for such large files.


0 additional answers

Sort by: Most helpful