Share via


JsonRpcRequest.TryGetArgumentByNameOrIndex Method

Definition

Retrieves an argument for the RPC request.

public virtual bool TryGetArgumentByNameOrIndex (string name, int position, Type typeHint, out object value);
public virtual bool TryGetArgumentByNameOrIndex (string? name, int position, Type? typeHint, out object? value);
abstract member TryGetArgumentByNameOrIndex : string * int * Type * obj -> bool
override this.TryGetArgumentByNameOrIndex : string * int * Type * obj -> bool
Public Overridable Function TryGetArgumentByNameOrIndex (name As String, position As Integer, typeHint As Type, ByRef value As Object) As Boolean

Parameters

name
String

The name of the parameter that requires an argument. May be null if the caller knows they want a positional argument.

position
Int32

The index of the parameter that requires an argument. May be -1 for an argument with no position.

typeHint
Type

The type of the parameter that requires an argument. May be null if the type need not be coerced.

value
Object

Receives the value of the argument, if it exists. It MAY be returned even if it does not conform to typeHint.

Returns

true if an argument is available for a parameter with the given name or position; false otherwise.

Exceptions

Thrown if the argument exists, but cannot be deserialized.

Remarks

A derived-type may override this method in order to consider the typeHint and deserialize the required argument on-demand such that it can satisfy the type requirement.

Applies to