public static CallSettings MergedWith(this CallSettings original, CallSettings overlaid)
This method merges the settings in overlaid with those in
original, with overlaid taking priority.
If both arguments are null, the result is null. If one argument is null,
the other argument is returned. Otherwise, a new object is created with a property-wise
overlay, where null values do not override non-null values.
Any header mutations are combined, however: the mutation from the original is
performed, then the mutation in the overlay.
public static CallSettings WithEarlierDeadline(this CallSettings settings, DateTime? deadline, IClock clock)
Returns a CallSettings which will have an effective deadline of at least deadline.
If settings already observes an earlier deadline (with respect to clock),
or if deadline is null, the original settings will be returned.
Expiration to use in the returned settings, possibly as part of a retry. May be null,
in which case any expiration in settings is not present in the new call settings. If
both this and settings are null, the return value is null.
A new set of call settings including the specified header.
Remarks
Existing headers in settings will not be overritten, that is, if settings
already contains a header for name the new value
will be included in that header's set of values, even if it was already present
in settings for the header with the given name.
Call timing for the new call settings.
This may be null, in which case any retry settings in settings are
not present in the new call settings. If both this and settings are null,
the return value is null.
[[["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\u003eThe \u003ccode\u003eCallSettingsExtensions\u003c/code\u003e class provides extension methods for the \u003ccode\u003eCallSettings\u003c/code\u003e class, enhancing its functionality by enabling the modification of call settings.\u003c/p\u003e\n"],["\u003cp\u003eMethods within \u003ccode\u003eCallSettingsExtensions\u003c/code\u003e allow merging settings, setting cancellation tokens, managing deadlines and timeouts, and handling headers and metadata.\u003c/p\u003e\n"],["\u003cp\u003eSeveral methods facilitate the creation of new \u003ccode\u003eCallSettings\u003c/code\u003e objects with specific properties, such as \u003ccode\u003eWithCancellationToken\u003c/code\u003e, \u003ccode\u003eWithDeadline\u003c/code\u003e, \u003ccode\u003eWithTimeout\u003c/code\u003e, and \u003ccode\u003eWithHeader\u003c/code\u003e, all accepting a potentially null original \u003ccode\u003eCallSettings\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMergedWith\u003c/code\u003e method allows for combining settings where the \u003ccode\u003eoverlaid\u003c/code\u003e settings take precedence over the \u003ccode\u003eoriginal\u003c/code\u003e, and it also handles the combination of header mutations.\u003c/p\u003e\n"],["\u003cp\u003eThere are also methods that handle retries, and the setting of a response and trailing metadata handler for the call.\u003c/p\u003e\n"]]],[],null,["# Class CallSettingsExtensions (4.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [4.10.0 (latest)](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettingsExtensions)\n- [4.8.0](/dotnet/docs/reference/Google.Api.Gax/4.8.0/Google.Api.Gax.Grpc.CallSettingsExtensions)\n- [4.4.0](/dotnet/docs/reference/Google.Api.Gax/4.4.0/Google.Api.Gax.Grpc.CallSettingsExtensions)\n- [4.3.1](/dotnet/docs/reference/Google.Api.Gax/4.3.1/Google.Api.Gax.Grpc.CallSettingsExtensions)\n- [4.2.0](/dotnet/docs/reference/Google.Api.Gax/4.2.0/Google.Api.Gax.Grpc.CallSettingsExtensions)\n- [4.0.0](/dotnet/docs/reference/Google.Api.Gax/4.0.0/Google.Api.Gax.Grpc.CallSettingsExtensions)\n- [3.2.0](/dotnet/docs/reference/Google.Api.Gax/3.2.0/Google.Api.Gax.Grpc.CallSettingsExtensions) \n\n public static class CallSettingsExtensions\n\nExtension methods for [CallSettings](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings).\nAll methods accept a null first parameter as valid unless stated otherwise. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e CallSettingsExtensions \n\nInherited Members\n-----------------\n\n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Api.Gax.Grpc](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc)\n\nAssembly\n--------\n\nGoogle.Api.Gax.Grpc.dll\n\nMethods\n-------\n\n### MergedWith(CallSettings, CallSettings)\n\n public static CallSettings MergedWith(this CallSettings original, CallSettings overlaid)\n\nThis method merges the settings in `overlaid` with those in\n`original`, with `overlaid` taking priority.\nIf both arguments are null, the result is null. If one argument is null,\nthe other argument is returned. Otherwise, a new object is created with a property-wise\noverlay, where null values do not override non-null values.\nAny header mutations are combined, however: the mutation from the original is\nperformed, then the mutation in the overlay.\n\n### WithCancellationToken(CallSettings, CancellationToken)\n\n public static CallSettings WithCancellationToken(this CallSettings settings, CancellationToken cancellationToken)\n\nReturns a new [CallSettings](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings) with the specified cancellation token,\nmerged with the (optional) original settings specified by `settings`.\n\n### WithDeadline(CallSettings, DateTime)\n\n public static CallSettings WithDeadline(this CallSettings settings, DateTime deadline)\n\nReturns a [CallSettings](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings) which will have the specified deadline.\n\n### WithEarlierDeadline(CallSettings, DateTime?, IClock)\n\n public static CallSettings WithEarlierDeadline(this CallSettings settings, DateTime? deadline, IClock clock)\n\nReturns a [CallSettings](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings) which will have an effective deadline of at least `deadline`.\nIf `settings` already observes an earlier deadline (with respect to `clock`),\nor if `deadline` is null, the original settings will be returned.\n\n### WithExpiration(CallSettings, Expiration)\n\n public static CallSettings WithExpiration(this CallSettings settings, Expiration expiration)\n\nReturns a new [CallSettings](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings) with the specified expiration,\nmerged with the (optional) original settings specified by `settings`.\n\n### WithHeader(CallSettings, string, string)\n\n public static CallSettings WithHeader(this CallSettings settings, string name, string value)\n\nReturns a new [CallSettings](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings) with the specified header,\nmerged with the (optional) original settings specified by `settings`.\n\n**Remarks** \nExisting headers in settings will not be overritten, that is, if settings\nalready contains a header for `name` the new value\nwill be included in that header's set of values, even if it was already present\nin settings for the header with the given name.\n\n### WithResponseMetadataHandler(CallSettings, Action\\\u003cMetadata\\\u003e)\n\n public static CallSettings WithResponseMetadataHandler(this CallSettings settings, Action\u003cMetadata\u003e handler)\n\n### WithRetry(CallSettings, RetrySettings)\n\n public static CallSettings WithRetry(this CallSettings settings, RetrySettings retry)\n\nReturns a new [CallSettings](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings) with the specified retry settings,\nmerged with the (optional) original settings specified by `settings`.\n\n### WithTimeout(CallSettings, TimeSpan)\n\n public static CallSettings WithTimeout(this CallSettings settings, TimeSpan timeout)\n\nReturns a [CallSettings](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings) which will have the specified timeout.\n\n### WithTrailingMetadataHandler(CallSettings, Action\\\u003cMetadata\\\u003e)\n\n public static CallSettings WithTrailingMetadataHandler(this CallSettings settings, Action\u003cMetadata\u003e handler)"]]