Gets or sets the number of bytes allocated for this stream.
[Visual Basic] Public Property Capacity As Integer [C#] public int Capacity {get; set;} [C++] public: __property int get_Capacity(); public: __property void set_Capacity(int); [JScript] public function get Capacity() : int; public function set Capacity(int);
The length of the usable portion of the buffer for the stream.
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | A capacity is set that is negative or less than the current length of the stream. |
NotSupportedException | Set is invoked on a stream that is closed or whose capacity cannot be modified. |
Capacity is the buffer length for system-provided byte arrays. Capacity cannot be set to a value less than the current length of the stream.
MemoryStream Class | MemoryStream Members | System.IO Namespace