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

◆ EnsureCapacity()

bool System.IO.MemoryStream.EnsureCapacity ( int value)
inlineprivateinherited

Definition at line 212 of file MemoryStream.cs.

213 {
214 if (value < 0)
215 {
216 throw new IOException(SR.IO_StreamTooLong);
217 }
218 if (value > _capacity)
219 {
220 int num = Math.Max(value, 256);
221 if (num < _capacity * 2)
222 {
223 num = _capacity * 2;
224 }
225 if ((uint)(_capacity * 2) > Array.MaxLength)
226 {
227 num = Math.Max(value, Array.MaxLength);
228 }
229 Capacity = num;
230 return true;
231 }
232 return false;
233 }

References System.IO.MemoryStream._capacity, System.IO.MemoryStream.Capacity, System.SR.IO_StreamTooLong, System.Math.Max(), System.Array.MaxLength, and System.value.

Referenced by System.IO.MemoryStream.SetLength(), System.IO.MemoryStream.Write(), System.IO.MemoryStream.Write(), and System.IO.MemoryStream.WriteByte().