Share via


ClientResult.FromOptionalValue<T>(T, PipelineResponse) Method

Definition

Creates a new instance of ClientResult<T> that holds the provided model value, if any, and the PipelineResponse received from the service. This method is used to create a return value for a service method representing a service operation that may or may not contain a payload. Callers of the client's service method must check whether Value is null to determine whether the service provided a value in its response. Nullable annotations indicate to the end-user the need to check whether Value is null.

public static System.ClientModel.ClientResult<T?> FromOptionalValue<T> (T? value, System.ClientModel.Primitives.PipelineResponse response);
static member FromOptionalValue : 'T * System.ClientModel.Primitives.PipelineResponse -> System.ClientModel.ClientResult<'T>
Public Shared Function FromOptionalValue(Of T) (value As T, response As PipelineResponse) As ClientResult(Of T)

Type Parameters

T

The type of the value.

Parameters

value
T

The strongly-typed representation of the service response payload value.

response
PipelineResponse

The response received from the service.

Returns

A new instance of ClientResult<T> holding the provided value and response.

Applies to