Table of Contents

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

original NumberRemoteValue

Properties

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

Value

Gets the numeric value of this remote value.

[JsonPropertyName("value")]
[JsonInclude]
[JsonConverter(typeof(NumberJsonConverter))]
[JsonRequired]
public override double Value { get; }

Property Value

double

Methods

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Equals(NumberRemoteValue?)

public virtual bool Equals(NumberRemoteValue? other)

Parameters

other NumberRemoteValue

Returns

bool

Equals(ValueHoldingRemoteValue<double>?)

public override sealed bool Equals(ValueHoldingRemoteValue<double>? other)

Parameters

other ValueHoldingRemoteValue<double>

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

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

string

Operators

operator ==(NumberRemoteValue?, NumberRemoteValue?)

public static bool operator ==(NumberRemoteValue? left, NumberRemoteValue? right)

Parameters

left NumberRemoteValue
right NumberRemoteValue

Returns

bool

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

value NumberRemoteValue

The value to convert.

Returns

double

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

value NumberRemoteValue

The value to convert.

Returns

int

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

value NumberRemoteValue

The value to convert.

Returns

long

operator !=(NumberRemoteValue?, NumberRemoteValue?)

public static bool operator !=(NumberRemoteValue? left, NumberRemoteValue? right)

Parameters

left NumberRemoteValue
right NumberRemoteValue

Returns

bool