Sets the length of the current stream to the specified value.
- value
- A long that specifies the new length of the stream.
Type Reason System.IO.IOException An I/O error occurred. NotSupportedException The current stream does not support writing and seeking. ArgumentOutOfRangeException value is less than zero.
If value is less than the current length of the stream, the stream is truncated. If value is greater than the current length of the stream, the stream is expanded, and the contents of the stream between the old and the new length are undefined. A stream is required to support both writing and seeking to implement FileStream.SetLength(long).
Note:Use the FileStream.CanWrite property to determine whether the current instance supports writing, and the FileStream.CanSeek property to determine whether seeking is supported. For additional information, see Stream.CanWrite and Stream.CanSeek .
This method overrides Stream.SetLength(long).
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0