Show / Hide Table of Contents

Struct CallOptions

Options for calls made by client.

Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
Namespace: Grpc.Core
Assembly: Grpc.Core.Api.dll
Syntax
public struct CallOptions

Constructors

CallOptions(Metadata, Nullable<DateTime>, CancellationToken, WriteOptions, ContextPropagationToken, CallCredentials)

Creates a new instance of CallOptions struct.

Declaration
public CallOptions(Metadata headers = null, DateTime? deadline = default(DateTime? ), CancellationToken cancellationToken = default(CancellationToken), WriteOptions writeOptions = null, ContextPropagationToken propagationToken = null, CallCredentials credentials = null)
Parameters
Type Name Description
Metadata headers

Headers to be sent with the call.

System.Nullable<System.DateTime> deadline

Deadline for the call to finish. null means no deadline.

System.Threading.CancellationToken cancellationToken

Can be used to request cancellation of the call.

WriteOptions writeOptions

Write options that will be used for this call.

ContextPropagationToken propagationToken

Context propagation token obtained from ServerCallContext.

CallCredentials credentials

Credentials to use for this call.

Properties

CancellationToken

Token that can be used for cancelling the call on the client side. Cancelling the token will request cancellation of the remote call. Best effort will be made to deliver the cancellation notification to the server and interaction of the call with the server side will be terminated. Unless the call finishes before the cancellation could happen (there is an inherent race), the call will finish with StatusCode.Cancelled status.

Declaration
public CancellationToken CancellationToken { get; }
Property Value
Type Description
System.Threading.CancellationToken

Credentials

Credentials to use for this call.

Declaration
public CallCredentials Credentials { get; }
Property Value
Type Description
CallCredentials

Deadline

Call deadline.

Declaration
public DateTime? Deadline { get; }
Property Value
Type Description
System.Nullable<System.DateTime>

Headers

Headers to send at the beginning of the call.

Declaration
public Metadata Headers { get; }
Property Value
Type Description
Metadata

IsWaitForReady

If true and and channel is in ChannelState.TransientFailure, the call will attempt waiting for the channel to recover instead of failing immediately (which is the default "FailFast" semantics). Note: experimental API that can change or be removed without any prior notice.

Declaration
public bool IsWaitForReady { get; }
Property Value
Type Description
System.Boolean

PropagationToken

Token for propagating parent call context.

Declaration
public ContextPropagationToken PropagationToken { get; }
Property Value
Type Description
ContextPropagationToken

WriteOptions

Write options that will be used for this call.

Declaration
public WriteOptions WriteOptions { get; }
Property Value
Type Description
WriteOptions

Methods

WithCancellationToken(CancellationToken)

Returns new instance of CallOptions with CancellationToken set to the value provided. Values of all other fields are preserved.

Declaration
public CallOptions WithCancellationToken(CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
CallOptions

WithCredentials(CallCredentials)

Returns new instance of CallOptions with Credentials set to the value provided. Values of all other fields are preserved.

Declaration
public CallOptions WithCredentials(CallCredentials credentials)
Parameters
Type Name Description
CallCredentials credentials

The call credentials.

Returns
Type Description
CallOptions

WithDeadline(DateTime)

Returns new instance of CallOptions with Deadline set to the value provided. Values of all other fields are preserved.

Declaration
public CallOptions WithDeadline(DateTime deadline)
Parameters
Type Name Description
System.DateTime deadline

The deadline.

Returns
Type Description
CallOptions

WithHeaders(Metadata)

Returns new instance of CallOptions with Headers set to the value provided. Values of all other fields are preserved.

Declaration
public CallOptions WithHeaders(Metadata headers)
Parameters
Type Name Description
Metadata headers

The headers.

Returns
Type Description
CallOptions

WithPropagationToken(ContextPropagationToken)

Returns new instance of CallOptions with PropagationToken set to the value provided. Values of all other fields are preserved.

Declaration
public CallOptions WithPropagationToken(ContextPropagationToken propagationToken)
Parameters
Type Name Description
ContextPropagationToken propagationToken

The context propagation token.

Returns
Type Description
CallOptions

WithWaitForReady(Boolean)

Returns new instance of CallOptions with "WaitForReady" semantics enabled/disabled. IsWaitForReady. Note: experimental API that can change or be removed without any prior notice.

Declaration
public CallOptions WithWaitForReady(bool waitForReady = true)
Parameters
Type Name Description
System.Boolean waitForReady
Returns
Type Description
CallOptions

WithWriteOptions(WriteOptions)

Returns new instance of CallOptions with WriteOptions set to the value provided. Values of all other fields are preserved.

Declaration
public CallOptions WithWriteOptions(WriteOptions writeOptions)
Parameters
Type Name Description
WriteOptions writeOptions

The write options.

Returns
Type Description
CallOptions
Back to top