Stream.Write Stream.Write Stream.Write Stream.Write Method

Definition

Overloads

Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>)
Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32)

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>)

public:
 virtual void Write(ReadOnlySpan<System::Byte> buffer);
public virtual void Write (ReadOnlySpan<byte> buffer);
abstract member Write : ReadOnlySpan<byte> -> unit
override this.Write : ReadOnlySpan<byte> -> unit
Public Overridable Sub Write (buffer As ReadOnlySpan(Of Byte))
Parameters
buffer
ReadOnlySpan<Byte>

Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32)

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

public:
 abstract void Write(cli::array <System::Byte> ^ buffer, int offset, int count);
public abstract void Write (byte[] buffer, int offset, int count);
abstract member Write : byte[] * int * int -> unit
Public MustOverride Sub Write (buffer As Byte(), offset As Integer, count As Integer)
Parameters
buffer
Byte[]

An array of bytes. This method copies count bytes from buffer to the current stream.

offset
Int32 Int32 Int32 Int32

The zero-based byte offset in buffer at which to begin copying bytes to the current stream.

count
Int32 Int32 Int32 Int32

The number of bytes to be written to the current stream.

Exceptions

The sum of offset and count is greater than the buffer length.

An I/O error occured, such as the specified file cannot be found.

Remarks

Use the CanWrite property to determine whether the current instance supports writing. Use the WriteAsync method to write asynchronously to the current stream.

If the write operation is successful, the position within the stream advances by the number of bytes written. If an exception occurs, the position within the stream remains unchanged.

See Also

Applies to