共用方式為


FileStream.Write Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Writes a block of bytes to this stream using data from a buffer.

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

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Overrides Sub Write ( _
    array As Byte(), _
    offset As Integer, _
    count As Integer _
)
[SecuritySafeCriticalAttribute]
public override void Write(
    byte[] array,
    int offset,
    int count
)

Parameters

  • array
    Type: array<System.Byte[]
    The buffer containing data to write to the stream.
  • offset
    Type: System.Int32
    The zero-based byte offset in array at which to begin copying bytes to the current stream.
  • count
    Type: System.Int32
    The number of bytes to be written to the current stream.

Exceptions

Exception Condition
ArgumentNullException

array is nulla null reference (Nothing in Visual Basic).

ArgumentException

offset and count describe an invalid range in array.

ArgumentOutOfRangeException

offset or count is negative.

IOException

An I/O error occurs.

- or -

Another thread may have caused an unexpected change in the position of the operating system's file handle.

ObjectDisposedException

The stream is closed.

NotSupportedException

The current stream instance does not support writing.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.