Mono Class Library: System.IO.Stream Overview | MembersSystem.IO.Stream.SetLength Method |
Sets the length of the current stream. [Edit]
|
Type Reason NotSupportedException The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output. [Edit] ObjectDisposedException The stream is closed. [Edit] System.IO.IOException An I/O error occurred. [Edit]
Note: Use the Stream.CanWrite property to determine whether the current instance supports writing, and the Stream.CanSeek property to determine whether seeking is supported.Operation
If the specified value is less than the current length of the stream, the stream is truncated. If the specified value is larger than the current length of the stream, the stream is expanded. If the stream is expanded, the contents of the stream between the old and the new length are initialized to zeros.There is no default implementation.
Note to Inheritors
Classes derived from System.IO.Stream are required to support both writing and seeking for Stream.SetLength(long) to work. [Edit]
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0