Export (0) Print
Expand All

MemoryStream Constructor ()

.NET Framework 1.1

Initializes a new instance of the MemoryStream class with an expandable capacity initialized to zero.

[Visual Basic]
Public Sub New()
[C#]
public MemoryStream();
[C++]
public: MemoryStream();
[JScript]
public function MemoryStream();

Remarks

For an example of creating a file and writing text to a file, see Writing Text to a File. For an example of reading text from a file, see Reading Text from a File. For an example of reading from and writing to a binary file, see Reading and Writing to a Newly Created Data File.

The CanRead, CanSeek, and CanWrite properties are all set to true.

The capacity of the current stream automatically increases when you use the SetLength method to set the length to a value larger than the capacity of the current stream.

This constructor exposes the underlying stream, which GetBuffer returns.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

MemoryStream Class | MemoryStream Members | System.IO Namespace | MemoryStream Constructor Overload List | Working with I/O | Reading Text from a File | Writing Text to a File

Show:
© 2014 Microsoft