JsonEncodedText 结构

定义

提供将 UTF-8 或 UTF-16 编码文本转换为适用于 JSON 的表单的方法。Provides methods to transform UTF-8 or UTF-16 encoded text into a form that is suitable for JSON.

public value class JsonEncodedText : IEquatable<System::Text::Json::JsonEncodedText>
public struct JsonEncodedText : IEquatable<System.Text.Json.JsonEncodedText>
type JsonEncodedText = struct
Public Structure JsonEncodedText
Implements IEquatable(Of JsonEncodedText)
继承
JsonEncodedText
实现

注解

此类型可用于缓存和存储用于提前编写 JSON 的已知字符串,方法是在前面预先对它们进行编码。This type can be used to cache and store known strings used for writing JSON ahead of time by pre-encoding them up front.

属性

EncodedUtf8Bytes

获取预编码 JSON 文本的 UTF-8 编码表示形式。Gets the UTF-8 encoded representation of the pre-encoded JSON text.

方法

Encode(ReadOnlySpan<Byte>, JavaScriptEncoder)

将 UTF-8 文本值编码为 JSON 字符串。Encodes a UTF-8 text value as a JSON string.

Encode(ReadOnlySpan<Char>, JavaScriptEncoder)

将指定文本值编码为 JSON 字符串。Encodes a specified text value as a JSON string.

Encode(String, JavaScriptEncoder)

将字符串文本值编码为 JSON 字符串。Encodes the string text value as a JSON string.

Equals(JsonEncodedText)

确定此实例是否与另一个指定的 JsonEncodedText 实例具有相同的值。Determines whether this instance and another specified JsonEncodedText instance have the same value.

Equals(Object)

确定此实例是否与指定的对象(也必须是 JsonEncodedText 实例)具有相同的值。Determines whether this instance and a specified object, which must also be a JsonEncodedText instance, have the same value.

GetHashCode()

返回此 JsonEncodedText 的哈希代码。Returns the hash code for this JsonEncodedText.

ToString()

将此实例的值转换为 StringConverts the value of this instance to a String.

适用于