NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MemoryStream.SetLength

Sets the length of the current stream to the specified value.

[Visual Basic]
Overrides Public Sub SetLength( _
   ByVal value As Long _
)
[C#]
public override void SetLength(
   long value
);
[C++]
public: override void SetLength(
   __int64 value
);
[JScript]
public override function SetLength(
   value : long
);

Parameters

value
The value at which to set the length.

Exceptions

Exception Type Condition
ArgumentException value is negative or is greater than Int32.MaxValue minus the origin.
NotSupportedException The current stream is not resizable and value is larger than the current capacity.
IOException The current stream does not support writing.

Remarks

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 capacity and the stream is resizable, then the capacity is increased; otherwise a NotSupportedException is thrown. If the length is increased, the contents of the stream between the old and the new length are undefined. A stream must support both writing and seeking for this method to be operational.

See Also

MemoryStream Class | MemoryStream Members | System.IO Namespace