Επεξεργασία

Κοινή χρήση μέσω


Utf8JsonReader.CopyString Method

Definition

Overloads

CopyString(Span<Byte>)

Copies the current JSON token value from the source, unescaped, as UTF-8 bytes to a buffer.

CopyString(Span<Char>)

Copies the current JSON token value from the source, unescaped, as UTF-16 characters to a buffer.

CopyString(Span<Byte>)

Source:
Utf8JsonReader.TryGet.cs
Source:
Utf8JsonReader.TryGet.cs
Source:
Utf8JsonReader.TryGet.cs
Source:
Utf8JsonReader.TryGet.cs
Source:
Utf8JsonReader.TryGet.cs

Copies the current JSON token value from the source, unescaped, as UTF-8 bytes to a buffer.

public:
 int CopyString(Span<System::Byte> utf8Destination);
public readonly int CopyString (Span<byte> utf8Destination);
member this.CopyString : Span<byte> -> int
Public Function CopyString (utf8Destination As Span(Of Byte)) As Integer

Parameters

utf8Destination
Span<Byte>

A buffer to write the unescaped UTF-8 bytes into.

Returns

The number of bytes written to utf8Destination.

Exceptions

The JSON token is not a string, that is, it's not String or PropertyName.

-or-

The JSON string contains invalid UTF-8 bytes or invalid UTF-16 surrogates.

The destination buffer is too small to hold the unescaped value.

Remarks

Unlike GetString(), this method does not support Null.

This method will throw an ArgumentException if the destination buffer is too small to hold the unescaped value. You can determine an appropriately sized buffer by consulting the length of either ValueSpan or ValueSequence, since the unescaped result is always less than or equal to the length of the encoded strings.

See also

Applies to

CopyString(Span<Char>)

Source:
Utf8JsonReader.TryGet.cs
Source:
Utf8JsonReader.TryGet.cs
Source:
Utf8JsonReader.TryGet.cs
Source:
Utf8JsonReader.TryGet.cs
Source:
Utf8JsonReader.TryGet.cs

Copies the current JSON token value from the source, unescaped, as UTF-16 characters to a buffer.

public:
 int CopyString(Span<char> destination);
public readonly int CopyString (Span<char> destination);
member this.CopyString : Span<char> -> int
Public Function CopyString (destination As Span(Of Char)) As Integer

Parameters

destination
Span<Char>

A buffer to write the transcoded UTF-16 characters into.

Returns

The number of characters written to destination.

Exceptions

The JSON token is not a string, that is, it's not String or PropertyName.

-or-

The JSON string contains invalid UTF-8 bytes or invalid UTF-16 surrogates.

The destination buffer is too small to hold the unescaped value.

Remarks

Unlike GetString(), this method does not support Null.

This method will throw an ArgumentException if the destination buffer is too small to hold the unescaped value. You can determine an appropriately sized buffer by consulting the length of either ValueSpan or ValueSequence, since the unescaped result is always less than or equal to the length of the encoded strings.

See also

Applies to