/// <summary> /// Writes the property name and raw bytes value (as a base 64 encoded JSON string) as part of a name/value pair of a JSON object. /// </summary> /// <param name="utf8PropertyName">The UTF-8 encoded property name of the JSON object to be written.</param> /// <param name="bytes">The binary data to be written as a base 64 encoded JSON string as part of the name/value pair.</param> /// <remarks> /// The property name is escaped before writing. /// </remarks> /// <exception cref="ArgumentException"> /// Thrown when the specified property name is too large. /// </exception> /// <exception cref="InvalidOperationException"> /// Thrown if this would result in an invalid JSON to be written (while validation is enabled). /// </exception> public void WriteBase64String(ReadOnlySpan <byte> utf8PropertyName, ReadOnlySpan <byte> bytes) { JsonWriterHelper.ValidatePropertyAndBytes(utf8PropertyName, bytes); WriteBase64Escape(utf8PropertyName, bytes); SetFlagToAddListSeparatorBeforeNextItem(); _tokenType = JsonTokenType.String; }