Class EvaluateResult
- Namespace
- WebDriverBiDi.Script
- Assembly
- WebDriverBiDi.dll
Base class for the result of a script evaluation.
[JsonConverter(typeof(DiscriminatedUnionJsonConverter<EvaluateResult>))]
[DiscriminatedTypeProperty("type")]
[DiscriminatedDerivedType(typeof(EvaluateResultSuccess), "success")]
[DiscriminatedDerivedType(typeof(EvaluateResultException), "exception")]
public record EvaluateResult : CommandResult, IEquatable<CommandResult>, IEquatable<EvaluateResult>
- Inheritance
-
EvaluateResult
- Implements
- Derived
- Inherited Members
Constructors
EvaluateResult()
Initializes a new instance of the EvaluateResult class.
protected EvaluateResult()
EvaluateResult(EvaluateResult)
protected EvaluateResult(EvaluateResult original)
Parameters
originalEvaluateResult
Properties
EqualityContract
protected override Type EqualityContract { get; }
Property Value
RealmId
Gets the ID of the realm in which the script was executed.
[JsonPropertyName("realm")]
[JsonRequired]
[JsonInclude]
public string RealmId { get; }
Property Value
ResultType
Gets the type of the result of the script execution.
[JsonPropertyName("type")]
[JsonRequired]
[JsonInclude]
public EvaluateResultType ResultType { get; }
Property Value
Methods
As<T>()
Casts this EvaluateResult to a type-specific evaluation result, throwing if it is not of that type. Use TryAs<T>(out T?) to test without throwing.
public T As<T>() where T : EvaluateResult
Returns
- T
This instance cast to the specified correct type.
Type Parameters
TThe specific type of EvaluateResult to return.
Exceptions
- WebDriverBiDiException
Thrown if this EvaluateResult is not the specified type.
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
Equals(CommandResult?)
public override sealed bool Equals(CommandResult? other)
Parameters
otherCommandResult
Returns
Equals(EvaluateResult?)
public virtual bool Equals(EvaluateResult? other)
Parameters
otherEvaluateResult
Returns
GetHashCode()
public override int GetHashCode()
Returns
PrintMembers(StringBuilder)
protected override bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
ToString()
public override string ToString()
Returns
TryAs<T>(out T?)
Attempts to cast this EvaluateResult to a type-specific evaluation result, returning false rather than throwing when it is not of that type.
public bool TryAs<T>(out T? result) where T : EvaluateResult
Parameters
resultTWhen this method returns, contains the cast value or null if the cast failed.
Returns
Type Parameters
TThe specific type of EvaluateResult to return.
Operators
operator ==(EvaluateResult?, EvaluateResult?)
public static bool operator ==(EvaluateResult? left, EvaluateResult? right)
Parameters
leftEvaluateResultrightEvaluateResult
Returns
operator !=(EvaluateResult?, EvaluateResult?)
public static bool operator !=(EvaluateResult? left, EvaluateResult? right)
Parameters
leftEvaluateResultrightEvaluateResult