Class NumberRemoteValue
- Namespace
- WebDriverBiDi.Script
- Assembly
- WebDriverBiDi.dll
Represents a remote value for a number, providing type-safe access to the value and the ability to convert to a local value for use as an argument for script execution on the remote end.
public record NumberRemoteValue : ValueHoldingRemoteValue<double>, IEquatable<RemoteValue>, IEquatable<ValueHoldingRemoteValue>, ITypeSafeRemoteValue<double>, IEquatable<ValueHoldingRemoteValue<double>>, IEquatable<NumberRemoteValue>
- Inheritance
-
NumberRemoteValue
- Implements
- Inherited Members
Constructors
NumberRemoteValue(NumberRemoteValue)
protected NumberRemoteValue(NumberRemoteValue original)
Parameters
originalNumberRemoteValue
Properties
EqualityContract
protected override Type EqualityContract { get; }
Property Value
Value
Gets the numeric value of this remote value.
[JsonPropertyName("value")]
[JsonInclude]
[JsonConverter(typeof(NumberJsonConverter))]
[JsonRequired]
public override double Value { get; }
Property Value
Methods
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
Equals(NumberRemoteValue?)
public virtual bool Equals(NumberRemoteValue? other)
Parameters
otherNumberRemoteValue
Returns
Equals(ValueHoldingRemoteValue<double>?)
public override sealed bool Equals(ValueHoldingRemoteValue<double>? other)
Parameters
otherValueHoldingRemoteValue<double>
Returns
GetHashCode()
public override int GetHashCode()
Returns
PrintMembers(StringBuilder)
protected override bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
ToInt()
Gets the numeric value of this remote value as an integer, converting from double to integer as needed.
public int ToInt()
Returns
- int
The numeric value as an integer.
Remarks
A JavaScript number is a double, so this conversion is narrowing and never throws. The fractional
part is truncated toward zero (for example, 2.7 becomes 2 and -2.7 becomes
-2). Values that have no int representation are mapped as follows: NaN
becomes 0, and any value greater than MaxValue (including Infinity)
or less than MinValue (including -Infinity) saturates to
MaxValue or MinValue respectively. Read
Value when the exact value must be preserved, including
detecting NaN or an infinity.
ToLocalValue()
Converts this remote value to a local value for use as an argument for script execution on the remote end.
public override LocalValue ToLocalValue()
Returns
- LocalValue
A LocalValue representing the numeric value.
ToLong()
Gets the numeric value of this remote value as a long, converting from double to long as needed.
public long ToLong()
Returns
- long
The numeric value as a long.
Remarks
A JavaScript number is a double, so this conversion is narrowing and never throws. The fractional
part is truncated toward zero (for example, 2.7 becomes 2 and -2.7 becomes
-2). Values that have no long representation are mapped as follows: NaN
becomes 0, and any value greater than MaxValue (including Infinity)
or less than MinValue (including -Infinity) saturates to
MaxValue or MinValue respectively. Read
Value when the exact value must be preserved, including
detecting NaN or an infinity.
ToString()
public override string ToString()
Returns
Operators
operator ==(NumberRemoteValue?, NumberRemoteValue?)
public static bool operator ==(NumberRemoteValue? left, NumberRemoteValue? right)
Parameters
leftNumberRemoteValuerightNumberRemoteValue
Returns
implicit operator double(NumberRemoteValue)
Defines an implicit conversion from a NumberRemoteValue to a double, allowing for easy access to the numeric value of this remote value.
public static implicit operator double(NumberRemoteValue value)
Parameters
valueNumberRemoteValueThe value to convert.
Returns
implicit operator int(NumberRemoteValue)
Defines an implicit conversion from a NumberRemoteValue to an integer, allowing for easy access to the numeric value of this remote value. See ToInt() for the narrowing behavior.
public static implicit operator int(NumberRemoteValue value)
Parameters
valueNumberRemoteValueThe value to convert.
Returns
implicit operator long(NumberRemoteValue)
Defines an implicit conversion from a NumberRemoteValue to a long, allowing for easy access to the numeric value of this remote value. See ToLong() for the narrowing behavior.
public static implicit operator long(NumberRemoteValue value)
Parameters
valueNumberRemoteValueThe value to convert.
Returns
operator !=(NumberRemoteValue?, NumberRemoteValue?)
public static bool operator !=(NumberRemoteValue? left, NumberRemoteValue? right)
Parameters
leftNumberRemoteValuerightNumberRemoteValue