Utf8JsonWriter.WriteBoolean Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
WriteBoolean(String, Boolean) |
Writes a property name specified as a string and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object. |
WriteBoolean(ReadOnlySpan<Byte>, Boolean) |
Writes a property name specified as a read-only span of bytes and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object. |
WriteBoolean(ReadOnlySpan<Char>, Boolean) |
Writes a property name specified as a read-only character span and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object. |
WriteBoolean(JsonEncodedText, Boolean) |
Writes the pre-encoded property name and Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object. |
WriteBoolean(String, Boolean)
Writes a property name specified as a string and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.
public:
void WriteBoolean(System::String ^ propertyName, bool value);
public void WriteBoolean (string propertyName, bool value);
member this.WriteBoolean : string * bool -> unit
Public Sub WriteBoolean (propertyName As String, value As Boolean)
Parameters
- propertyName
- String
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
- value
- Boolean
The value to be written as a JSON literal true or false as part of the name/value pair.
Exceptions
The specified property name is too large.
Validation is enabled, and the operation would result in writing invalid JSON.
The propertyName
parameter is null
.
Remarks
The property name is escaped before writing.
Applies to
WriteBoolean(ReadOnlySpan<Byte>, Boolean)
Writes a property name specified as a read-only span of bytes and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.
public:
void WriteBoolean(ReadOnlySpan<System::Byte> utf8PropertyName, bool value);
public void WriteBoolean (ReadOnlySpan<byte> utf8PropertyName, bool value);
member this.WriteBoolean : ReadOnlySpan<byte> * bool -> unit
Public Sub WriteBoolean (utf8PropertyName As ReadOnlySpan(Of Byte), value As Boolean)
Parameters
- utf8PropertyName
- ReadOnlySpan<Byte>
The UTF-8 encoded property name of the JSON object to be written.
- value
- Boolean
The value to be written as a JSON literal true or false as part of the name/value pair.
Exceptions
The specified property name is too large.
Validation is enabled, and the operation would result in writing invalid JSON.
Remarks
The property name is escaped before writing.
Applies to
WriteBoolean(ReadOnlySpan<Char>, Boolean)
Writes a property name specified as a read-only character span and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.
public:
void WriteBoolean(ReadOnlySpan<char> propertyName, bool value);
public void WriteBoolean (ReadOnlySpan<char> propertyName, bool value);
member this.WriteBoolean : ReadOnlySpan<char> * bool -> unit
Public Sub WriteBoolean (propertyName As ReadOnlySpan(Of Char), value As Boolean)
Parameters
- propertyName
- ReadOnlySpan<Char>
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
- value
- Boolean
The value to be written as a JSON literal true or false as part of the name/value pair.
Exceptions
The specified property name is too large.
Validation is enabled, and the operation would result in writing invalid JSON.
Remarks
The property name is escaped before writing.
Applies to
WriteBoolean(JsonEncodedText, Boolean)
Writes the pre-encoded property name and Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.
public:
void WriteBoolean(System::Text::Json::JsonEncodedText propertyName, bool value);
public void WriteBoolean (System.Text.Json.JsonEncodedText propertyName, bool value);
member this.WriteBoolean : System.Text.Json.JsonEncodedText * bool -> unit
Public Sub WriteBoolean (propertyName As JsonEncodedText, value As Boolean)
Parameters
- propertyName
- JsonEncodedText
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
- value
- Boolean
The value to be written as a JSON literal true or false as part of the name/value pair.
Exceptions
Validation is enabled, and this method would result in writing invalid JSON.
Remarks
The property name should already be escaped when the instance of JsonEncodedText was created.