MemoryStream.Capacity Property
Assembly: mscorlib (in mscorlib.dll)
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.
Capacity is the buffer length for system-provided byte arrays. Capacity cannot be set to a value less than the current length of the stream.
This code example is part of a larger example provided for the MemoryStream class.
// Write the stream properties to the console. Console.WriteLine( "Capacity = {0}, Length = {1}, Position = {2}\n", memStream.Capacity.ToString(), memStream.Length.ToString(), memStream.Position.ToString());
// Write the stream properties to the console.
Console.WriteLine(
"Capacity = {0}, Length = {1}, Position = {2}\n",
(new Integer( memStream.get_Capacity())).ToString(),
(new Long ( memStream.get_Length())).ToString(),
(new Long ( memStream.get_Position())).ToString());
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.