Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Capacity

virtual int System.IO.MemoryStream.Capacity
getsetinherited

Definition at line 36 of file MemoryStream.cs.

37 {
38 get
39 {
41 return _capacity - _origin;
42 }
43 set
44 {
45 if (value < Length)
46 {
47 throw new ArgumentOutOfRangeException("value", SR.ArgumentOutOfRange_SmallCapacity);
48 }
50 if (!_expandable && value != Capacity)
51 {
52 throw new NotSupportedException(SR.NotSupported_MemStreamNotExpandable);
53 }
54 if (!_expandable || value == _capacity)
55 {
56 return;
57 }
58 if (value > 0)
59 {
60 byte[] array = new byte[value];
61 if (_length > 0)
62 {
63 Buffer.BlockCopy(_buffer, 0, array, 0, _length);
64 }
65 _buffer = array;
66 }
67 else
68 {
69 _buffer = Array.Empty<byte>();
70 }
72 }
73 }

Referenced by System.IO.MemoryStream.EnsureCapacity().