# Class PgWriter

Namespace
  Npgsql.Internal

Assembly
  Npgsql.dll

    public sealed class PgWriter

Inheritance
  object
  PgWriter

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.ReferenceEquals(object, object)
  object.ToString()

## Properties

### Current

    public ValueMetadata Current { get; }

#### Property Value

ValueMetadata

## Methods

### BeginNestedWrite(Size, int, object?)

    public NestedWriteScope BeginNestedWrite(Size bufferRequirement, int byteCount, object? state)

#### Parameters

`bufferRequirement` Size
`byteCount` int
`state` object

#### Returns

NestedWriteScope

### BeginNestedWriteAsync(Size, int, object?, CancellationToken)

    public ValueTask<NestedWriteScope> BeginNestedWriteAsync(Size bufferRequirement, int byteCount, object? state, CancellationToken cancellationToken = default)

#### Parameters

`bufferRequirement` Size
`byteCount` int
`state` object
`cancellationToken` CancellationToken

#### Returns

ValueTask<NestedWriteScope>

### Flush(TimeSpan)

    public void Flush(TimeSpan timeout = default)

#### Parameters

`timeout` TimeSpan

### FlushAsync(CancellationToken)

    public ValueTask FlushAsync(CancellationToken cancellationToken = default)

#### Parameters

`cancellationToken` CancellationToken

#### Returns

ValueTask

### GetStream(bool)

Gets a Stream that can be used to write to the underlying buffer.

    public Stream GetStream(bool allowMixedIO = false)

#### Parameters

`allowMixedIO` bool

  Blocking flushes during writes that were expected to be non-blocking and vice versa cause an exception to be thrown unless allowMixedIO is set to true, false by default.

#### Returns

Stream

  The stream.

### ShouldFlush(Size)

    public bool ShouldFlush(Size bufferRequirement)

#### Parameters

`bufferRequirement` Size

#### Returns

bool

### ShouldFlush(int)

    public bool ShouldFlush(int byteCount)

#### Parameters

`byteCount` int

#### Returns

bool

### WriteAsOid(PgTypeId)

    public void WriteAsOid(PgTypeId pgTypeId)

#### Parameters

`pgTypeId` PgTypeId

### WriteByte(byte)

    public void WriteByte(byte value)

#### Parameters

`value` byte

### WriteBytes(ReadOnlySpan<byte>)

    public void WriteBytes(ReadOnlySpan<byte> buffer)

#### Parameters

`buffer` ReadOnlySpan<byte>

### WriteBytesAsync(ReadOnlyMemory<byte>, CancellationToken)

    public ValueTask WriteBytesAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)

#### Parameters

`buffer` ReadOnlyMemory<byte>
`cancellationToken` CancellationToken

#### Returns

ValueTask

### WriteChars(ReadOnlySpan<char>, Encoding)

    public void WriteChars(ReadOnlySpan<char> data, Encoding encoding)

#### Parameters

`data` ReadOnlySpan<char>
`encoding` Encoding

### WriteCharsAsync(ReadOnlyMemory<char>, Encoding, CancellationToken)

    public ValueTask WriteCharsAsync(ReadOnlyMemory<char> data, Encoding encoding, CancellationToken cancellationToken = default)

#### Parameters

`data` ReadOnlyMemory<char>
`encoding` Encoding
`cancellationToken` CancellationToken

#### Returns

ValueTask

### WriteDouble(double)

    public void WriteDouble(double value)

#### Parameters

`value` double

### WriteFloat(float)

    public void WriteFloat(float value)

#### Parameters

`value` float

### WriteInt16(short)

    public void WriteInt16(short value)

#### Parameters

`value` short

### WriteInt32(int)

    public void WriteInt32(int value)

#### Parameters

`value` int

### WriteInt64(long)

    public void WriteInt64(long value)

#### Parameters

`value` long

### WriteUInt16(ushort)

    public void WriteUInt16(ushort value)

#### Parameters

`value` ushort

### WriteUInt32(uint)

    public void WriteUInt32(uint value)

#### Parameters

`value` uint

### WriteUInt64(ulong)

    public void WriteUInt64(ulong value)

#### Parameters

`value` ulong