JsonElement.TryGetBytesFromBase64(Byte[]) 方法

定义

尝试将当前 JSON 字符串表示为字节数组(假定它是 Base64 编码)。Attempts to represent the current JSON string as a byte array, assuming that it is Base64 encoded.

public:
 bool TryGetBytesFromBase64([Runtime::InteropServices::Out] cli::array <System::Byte> ^ % value);
public bool TryGetBytesFromBase64 (out byte[]? value);
public bool TryGetBytesFromBase64 (out byte[] value);
member this.TryGetBytesFromBase64 : Byte[] -> bool
Public Function TryGetBytesFromBase64 (ByRef value As Byte()) As Boolean

参数

value
Byte[]

如果方法成功,则包含 Base64 文本的已解码二进制表示形式。If the method succeeds, contains the decoded binary representation of the Base64 text.

返回

Boolean

如果整个标记值编码为有效 base 64 文本并且可以成功解码为字节,则为 true;否则为 falsetrue if the entire token value is encoded as valid Base64 text and can be successfully decoded to bytes; otherwise, false.

例外

此值的 ValueKind 不是 StringThis value's ValueKind is not String.

已释放父级 JsonDocumentThe parent JsonDocument has been disposed.

注解

此方法不会创建 Base64 编码的 JSON 字符串以外的值的字节数组表示形式。This method does not create a byte array representation of values other than Base64 encoded JSON strings.

适用于