public CancellationToken CancellationToken { get; }
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 withStatusCode.Cancelledstatus.
Iftrueand channel is inChannelState.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.
public CallOptions WithWaitForReady(bool waitForReady = true)
Returns new instance ofCallOptionswith "WaitForReady" semantics enabled/disabled.IsWaitForReady.
Note: experimental API that can change or be removed without any prior notice.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eCallOptions\u003c/code\u003e is a struct used to configure options for client-initiated calls, allowing for customization of behavior during the call execution.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCallOptions\u003c/code\u003e struct includes parameters such as \u003ccode\u003eheaders\u003c/code\u003e, \u003ccode\u003edeadline\u003c/code\u003e, \u003ccode\u003ecancellationToken\u003c/code\u003e, \u003ccode\u003ewriteOptions\u003c/code\u003e, \u003ccode\u003epropagationToken\u003c/code\u003e, and \u003ccode\u003ecredentials\u003c/code\u003e, each serving a specific purpose in controlling call characteristics.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCallOptions\u003c/code\u003e allows modification of its parameters, with methods like \u003ccode\u003eWithCancellationToken\u003c/code\u003e, \u003ccode\u003eWithCredentials\u003c/code\u003e, \u003ccode\u003eWithDeadline\u003c/code\u003e, \u003ccode\u003eWithHeaders\u003c/code\u003e, \u003ccode\u003eWithPropagationToken\u003c/code\u003e, \u003ccode\u003eWithWaitForReady\u003c/code\u003e, and \u003ccode\u003eWithWriteOptions\u003c/code\u003e, each returning a new instance with the specified change.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eIsWaitForReady\u003c/code\u003e property of \u003ccode\u003eCallOptions\u003c/code\u003e determines whether a call should wait for the channel to recover from a \u003ccode\u003eChannelState.TransientFailure\u003c/code\u003e state, instead of failing immediately.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCancellationToken\u003c/code\u003e property allows cancellation of a call, with best effort made to deliver this cancellation notification to the server, ultimately resulting in a \u003ccode\u003eStatusCode.Cancelled\u003c/code\u003e status unless the call finishes before the cancellation is processed.\u003c/p\u003e\n"]]],[],null,["# Struct CallOptions (2.66.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.66.0 (latest)](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions)\n- [2.63.0](/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.CallOptions)\n- [2.48.0](/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.CallOptions) \n\n public struct CallOptions\n\nOptions for calls made by client. \n\nInherited Members\n-----------------\n\n[ValueType.Equals(object)](https://learn.microsoft.com/dotnet/api/system.valuetype.equals) \n[ValueType.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.valuetype.gethashcode) \n[ValueType.ToString()](https://learn.microsoft.com/dotnet/api/system.valuetype.tostring) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)\n\nNamespace\n---------\n\n[Grpc.Core](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)\n\nAssembly\n--------\n\nGrpc.Core.Api.dll\n\nConstructors\n------------\n\n### CallOptions(Metadata?, DateTime?, CancellationToken, WriteOptions?, ContextPropagationToken?, CallCredentials?)\n\n public CallOptions(Metadata? headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default, WriteOptions? writeOptions = null, ContextPropagationToken? propagationToken = null, CallCredentials? credentials = null)\n\nCreates a new instance of `CallOptions` struct.\n\nProperties\n----------\n\n### CancellationToken\n\n public CancellationToken CancellationToken { get; }\n\nToken that can be used for cancelling the call on the client side.\nCancelling the token will request cancellation\nof the remote call. Best effort will be made to deliver the cancellation\nnotification to the server and interaction of the call with the server side\nwill be terminated. Unless the call finishes before the cancellation could\nhappen (there is an inherent race),\nthe call will finish with `StatusCode.Cancelled` status.\n\n### Credentials\n\n public CallCredentials? Credentials { get; }\n\nCredentials to use for this call.\n\n### Deadline\n\n public DateTime? Deadline { get; }\n\nCall deadline.\n\n### Headers\n\n public Metadata? Headers { get; }\n\nHeaders to send at the beginning of the call.\n\n### IsWaitForReady\n\n public bool IsWaitForReady { get; }\n\nIf `true` and channel is in `ChannelState.TransientFailure`, the call will attempt waiting for the channel to recover\ninstead of failing immediately (which is the default \"FailFast\" semantics).\nNote: experimental API that can change or be removed without any prior notice.\n\n### PropagationToken\n\n public ContextPropagationToken? PropagationToken { get; }\n\nToken for propagating parent call context.\n\n### WriteOptions\n\n public WriteOptions? WriteOptions { get; }\n\nWrite options that will be used for this call.\n\nMethods\n-------\n\n### WithCancellationToken(CancellationToken)\n\n public CallOptions WithCancellationToken(CancellationToken cancellationToken)\n\nReturns new instance of [CallOptions](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions) with\n`CancellationToken` set to the value provided. Values of all other fields are preserved.\n\n### WithCredentials(CallCredentials)\n\n public CallOptions WithCredentials(CallCredentials credentials)\n\nReturns new instance of [CallOptions](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions) with\n`Credentials` set to the value provided. Values of all other fields are preserved.\n\n### WithDeadline(DateTime)\n\n public CallOptions WithDeadline(DateTime deadline)\n\nReturns new instance of [CallOptions](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions) with\n`Deadline` set to the value provided. Values of all other fields are preserved.\n\n### WithHeaders(Metadata)\n\n public CallOptions WithHeaders(Metadata headers)\n\nReturns new instance of [CallOptions](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions) with\n`Headers` set to the value provided. Values of all other fields are preserved.\n\n### WithPropagationToken(ContextPropagationToken)\n\n public CallOptions WithPropagationToken(ContextPropagationToken propagationToken)\n\nReturns new instance of [CallOptions](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions) with\n`PropagationToken` set to the value provided. Values of all other fields are preserved.\n\n### WithWaitForReady(bool)\n\n public CallOptions WithWaitForReady(bool waitForReady = true)\n\nReturns new instance of [CallOptions](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions) with \"WaitForReady\" semantics enabled/disabled.\n[IsWaitForReady](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions#Grpc_Core_CallOptions_IsWaitForReady).\nNote: experimental API that can change or be removed without any prior notice.\n\n### WithWriteOptions(WriteOptions)\n\n public CallOptions WithWriteOptions(WriteOptions writeOptions)\n\nReturns new instance of [CallOptions](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions) with\n`WriteOptions` set to the value provided. Values of all other fields are preserved."]]