1.73.0 (latest) 1.69.0 1.68.0 1.60.0 1.59.0 1.55.0 1.50.0

    public class BackOffHandler.Initializer

An initializer class to initialize a back-off handler.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> BackOffHandler.Initializer

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Apis.Http](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.md.txt)

## Assembly

Google.Apis.Core.dll

## Constructors

### Initializer(IBackOff)

    public Initializer(IBackOff backOff)

Constructs a new initializer by the given back-off.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `backOff` | `IBackOff` |

## Fields

### DefaultHandleExceptionFunc

    public static readonly Func<Exception, bool> DefaultHandleExceptionFunc

Default function which handles exception which aren't
[TaskCanceledException](https://learn.microsoft.com/dotnet/api/system.threading.tasks.taskcanceledexception) or
[OperationCanceledException](https://learn.microsoft.com/dotnet/api/system.operationcanceledexception). Those exceptions represent a task or an operation
which was canceled and shouldn't be retried.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `FuncExceptionbool` |   |

### DefaultHandleUnsuccessfulResponseFunc

    public static readonly Func<HttpResponseMessage, bool> DefaultHandleUnsuccessfulResponseFunc

Default function which handles server errors (503).

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `FuncHttpResponseMessagebool` |   |

## Properties

### BackOff

    public IBackOff BackOff { get; }

Gets the back-off policy used by this back-off handler.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `IBackOff` |   |

### HandleExceptionFunc

    public Func<Exception, bool> HandleExceptionFunc { get; set; }

Gets or sets a delegate function which indicates whether this back-off handler should handle an
exception. The default is [DefaultHandleExceptionFunc](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.BackOffHandler.Initializer.md.txt#Google_Apis_Http_BackOffHandler_Initializer_DefaultHandleExceptionFunc).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `FuncExceptionbool` |   |

### HandleUnsuccessfulResponseFunc

    public Func<HttpResponseMessage, bool> HandleUnsuccessfulResponseFunc { get; set; }

Gets or sets a delegate function which indicates whether this back-off handler should handle an
abnormal HTTP response. The default is [DefaultHandleUnsuccessfulResponseFunc](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.BackOffHandler.Initializer.md.txt#Google_Apis_Http_BackOffHandler_Initializer_DefaultHandleUnsuccessfulResponseFunc).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `FuncHttpResponseMessagebool` |   |

### MaxTimeSpan

    public TimeSpan MaxTimeSpan { get; set; }

Gets or sets the maximum time span to wait. If the back-off instance returns a greater time span than
this value, this handler returns `false` to both `HandleExceptionAsync` and
`HandleResponseAsync`. Default value is 16 seconds per a retry request.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `TimeSpan` |   |

## Extension Method

[Utilities.ThrowIfNull\<T\>(T, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities.md.txt#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)