SetLength Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

When overridden in a derived class, sets the length of the current stream.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

public abstract void SetLength(
	long value
)

Parameters

value
Type: System..::..Int64
The desired length of the current stream in bytes.

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 not defined.

A stream must support both writing and seeking for SetLength to work.

Use the CanWrite property to determine whether the current instance supports writing, and the CanSeek property to determine whether seeking is supported.

Show: