public override void SetLength(long value)
{
this.CheckDisposed();
if (value < 0 || value > MaxStreamLength)
{
throw new ArgumentOutOfRangeException("value", "value must be non-negative and at most " + MaxStreamLength);
}
this.EnsureCapacity((int)value);
this.length = (int)value;
if (this.position > value)
{
this.position = (int)value;
}
}