# Class AsyncUnaryCall&lt;TResponse&gt; (2.66.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.66.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1)
- [2.63.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.AsyncUnaryCall-1)
- [2.48.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.AsyncUnaryCall-1)

    public sealed class AsyncUnaryCall<TResponse> : IDisposable

Return type for single request - single response call.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> AsyncUnaryCall\<TResponse\>

## Implements

[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

## 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.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Grpc.Core](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)

## Assembly

Grpc.Core.Api.dll

| ## Type Parameter ||
|---|---|
| **Name** | **Description** |
| `TResponse` | Response message type for this call. |

## Constructors

### AsyncUnaryCall(Task\<TResponse\>, Func\<object, Task\<Metadata\>\>, Func\<object, Status\>, Func\<object, Metadata\>, Action\<object\>, object)

    public AsyncUnaryCall(Task<TResponse> responseAsync, Func<object, Task<Metadata>> responseHeadersAsync, Func<object, Status> getStatusFunc, Func<object, Metadata> getTrailersFunc, Action<object> disposeAction, object state)

Creates a new AsyncUnaryCall object with the specified properties.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `responseAsync` | `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1` The response of the asynchronous call. |
| `responseHeadersAsync` | `https://learn.microsoft.com/dotnet/api/system.func-2https://learn.microsoft.com/dotnet/api/system.objecthttps://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata` Response headers of the asynchronous call. |
| `getStatusFunc` | `https://learn.microsoft.com/dotnet/api/system.func-2https://learn.microsoft.com/dotnet/api/system.objecthttps://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Status` Delegate returning the status of the call. |
| `getTrailersFunc` | `https://learn.microsoft.com/dotnet/api/system.func-2https://learn.microsoft.com/dotnet/api/system.objecthttps://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata` Delegate returning the trailing metadata of the call. |
| `disposeAction` | `https://learn.microsoft.com/dotnet/api/system.action-1https://learn.microsoft.com/dotnet/api/system.object` Delegate to invoke when Dispose is called on the call object. |
| `state` | `https://learn.microsoft.com/dotnet/api/system.object` State object for use with the callback parameters. |

### AsyncUnaryCall(Task\<TResponse\>, Task\<Metadata\>, Func\<Status\>, Func\<Metadata\>, Action)

    public AsyncUnaryCall(Task<TResponse> responseAsync, Task<Metadata> responseHeadersAsync, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction)

Creates a new AsyncUnaryCall object with the specified properties.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `responseAsync` | `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1` The response of the asynchronous call. |
| `responseHeadersAsync` | `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata` Response headers of the asynchronous call. |
| `getStatusFunc` | `https://learn.microsoft.com/dotnet/api/system.func-1https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Status` Delegate returning the status of the call. |
| `getTrailersFunc` | `https://learn.microsoft.com/dotnet/api/system.func-1https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata` Delegate returning the trailing metadata of the call. |
| `disposeAction` | `https://learn.microsoft.com/dotnet/api/system.action` Delegate to invoke when Dispose is called on the call object. |

## Properties

### ResponseAsync

    public Task<TResponse> ResponseAsync { get; }

Asynchronous call result.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1` |   |

### ResponseHeadersAsync

    public Task<Metadata> ResponseHeadersAsync { get; }

Asynchronous access to response headers.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata` |   |

## Methods

### ConfigureAwait(bool)

    public ConfiguredTaskAwaitable<TResponse> ConfigureAwait(bool continueOnCapturedContext)

Configures an awaiter used to await this [AsyncUnaryCall\<TResponse\>](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `continueOnCapturedContext` | `https://learn.microsoft.com/dotnet/api/system.boolean` true to attempt to marshal the continuation back to the original context captured; otherwise, false. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.runtime.compilerservices.configuredtaskawaitable-1` | An object used to await this task. |

### Dispose()

    public void Dispose()

Provides means to cleanup after the call.
If the call has already finished normally (request stream has been completed and call result has been received), doesn't do anything.
Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call.
As a result, all resources being used by the call should be released eventually.
**Remarks** Normally, there is no need for you to dispose the call unless you want to utilize the
"Cancel" semantics of invoking `Dispose`.

### GetAwaiter()

    public TaskAwaiter<TResponse> GetAwaiter()

Gets an awaiter used to await this [AsyncUnaryCall\<TResponse\>](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.runtime.compilerservices.taskawaiter-1` | An awaiter instance. |

**Remarks** This method is intended for compiler use rather than use directly in code.

### GetStatus()

    public Status GetStatus()

Gets the call status if the call has already finished.
Throws InvalidOperationException otherwise.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Status` |   |

### GetTrailers()

    public Metadata GetTrailers()

Gets the call trailing metadata if the call has already finished.
Throws InvalidOperationException otherwise.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata` |   |