![]() |
VOOZH | about |
JsonMath Class
Namespace: Json.Schema
Inheritance: JsonMath 🡒 object
Provides static methods for performing mathematical operations and comparisons on JSON numeric values represented by System.Text.Json.JsonElement instances.
The methods in this class are designed to work directly with the textual representation of JSON numbers, enabling precise comparison and divisibility checks without converting to .NET numeric types. This is useful for scenarios where exact JSON number semantics are required, such as schema validation or custom JSON
Determines whether the numeric value represented by the specified JSON element is evenly divisible by the value of another JSON element.
1
public static bool Divides(JsonElement dividend, JsonElement divisor)
| Parameter | Type | Description |
|---|---|---|
| dividend | JsonElement | The JSON element representing the dividend. Must contain a valid numeric value. |
| divisor | JsonElement | The JSON element representing the divisor. Must contain a valid numeric value. |
true if the dividend is evenly divisible by the divisor; otherwise, false.
Both parameters must represent valid JSON numbers. If the divisor is zero or not a valid number,
Determines whether the numeric value represented by the specified JSON element is a mathematical integer (i.e. has no fractional part), without converting to a .NET numeric type.
1
public static bool IsInteger(JsonElement value)
| Parameter | Type | Description |
|---|---|---|
| value | JsonElement | A System.Text.Json.JsonElement whose System.Text.Json.JsonElement.ValueKind must be |
A new version of content is available.