The main limitation in .NET, unfortunately, is that objects cannot exceed 2 GB. The Stream class needs a long for its Length property, because Stream can represent a resource outside of .NET (for example, a file), but since a MemoryStream , as you know, is always internal memory, a managed object, it will always be able to set its Capacity to int .
source share