Class ValidationArgValue.Bool
- Namespace
- Trellis
- Assembly
- Trellis.Core.dll
A boolean operand, written to JSON as true or false.
public sealed record ValidationArgValue.Bool : ValidationArgValue, IEquatable<ValidationArgValue>, IEquatable<ValidationArgValue.Bool>
- Inheritance
-
ValidationArgValue.Bool
- Implements
- Inherited Members
- Extension Methods
Remarks
A boolean is rarely interpolated into a rendered message — you cannot put true into a
localized sentence — and a flag that selects which message to render usually belongs
in the reason code, which is the branch point a client is meant to switch on. The case exists
nonetheless because this union models JSON: without it a producer with a boolean operand has
to write Text("true"), which is the quoted-primitive problem this type was introduced
to remove, and a boolean arriving from a non-.NET producer would fail the whole payload.
Constructors
Bool(bool)
A boolean operand, written to JSON as true or false.
public Bool(bool Value)
Parameters
ValueboolThe flag.
Remarks
A boolean is rarely interpolated into a rendered message — you cannot put true into a
localized sentence — and a flag that selects which message to render usually belongs
in the reason code, which is the branch point a client is meant to switch on. The case exists
nonetheless because this union models JSON: without it a producer with a boolean operand has
to write Text("true"), which is the quoted-primitive problem this type was introduced
to remove, and a boolean arriving from a non-.NET producer would fail the whole payload.
Properties
Value
The flag.
public bool Value { get; init; }