# DurableTaskReference&lt;TResult&gt;

Package: [Microsoft.Orleans.Durable](/orleans/docs/api/csharp/microsoft.orleans.durable/) 10.0.0-alpha.1

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/DurableTasks/DurableTaskReference.cs#L36)

```csharp
public sealed class DurableTaskReference<TResult> : DurableTask<TResult>, IDurableTaskReference, IDurableTaskSubscription
```

A reference to an existing durable task of a grain, which [DurableTaskGrainExtensions](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskgrainextensions/) returns.

## Remarks

In a durable execution, the reference is a durable task definition: awaiting it, scheduling it, or passing it to a combinator subscribes a child of the execution to the task's result, which the execution records for replay.

Outside a durable execution, awaiting the reference waits for the task's result, and its polling members, such as `Orleans.Durable.Tasks.DurableTaskReference-1.GetResponseAsync(System.Threading.CancellationToken)`, `Orleans.Durable.Tasks.DurableTaskReference-1.WaitAsync(System.Threading.CancellationToken)`, and `Orleans.Durable.Tasks.DurableTaskReference-1.GetStatusAsync(Orleans.Durable.Tasks.PollingOptions,System.Threading.CancellationToken)`, and its control members, `Orleans.Durable.Tasks.DurableTaskReference-1.CancelAsync(System.String,System.Threading.CancellationToken)` and `Orleans.Durable.Tasks.DurableTaskReference-1.AbortAsync(System.String,System.Threading.CancellationToken)`, call the task's grain. Waits and polls retry the failures which leave the task unaffected, such as a lost connection, a crashed silo, or a deactivating activation, until the grain answers or the caller's token ends them. A durable execution doesn't record those calls.

The reference is awaitable through [DurableTaskReferenceExtensions](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreferenceextensions/), an extension method, so frameworks which inspect a return type's instance members, such as ASP.NET Core Minimal APIs, treat the reference as a value. [IDurableTaskReference](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.idurabletaskreference/) reads its `Orleans.Durable.Tasks.DurableTaskReference-1.Target` and `Orleans.Durable.Tasks.DurableTaskReference-1.Id` without its result type.

## Type parameters

- `TResult`: The task's result type.

## Properties

- [Address](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/properties/address-10bb8924/)
- [Id](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/properties/id-8c56686b/)
- [Target](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/properties/target-4799a815/)

## Methods

- [AbortAsync(string, CancellationToken)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/methods/abortasync-string-system-threading-cancellationtoken-6ab5228d/)
- [CancelAsync(CancellationToken)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/methods/cancelasync-system-threading-cancellationtoken-bbae8534/)
- [CancelAsync(string?, CancellationToken)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/methods/cancelasync-string-nullable-system-threading-cancellationtoken-af1a2c4a/)
- [GetResponseAsync(CancellationToken)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/methods/getresponseasync-system-threading-cancellationtoken-b3bea991/)
- [GetResponseAsync(PollingOptions, CancellationToken)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/methods/getresponseasync-orleans-durable-tasks-pollingoptions-system-threading-cancellat-3d29b966/)
- [GetStatusAsync(PollingOptions, CancellationToken)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/methods/getstatusasync-orleans-durable-tasks-pollingoptions-system-threading-cancellatio-2a8395d8/)
- [IsCompletedAsync(PollingOptions, CancellationToken)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/methods/iscompletedasync-orleans-durable-tasks-pollingoptions-system-threading-cancellat-171cd1ef/)
- [RunAsync(DurableTaskContext)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/methods/runasync-orleans-durable-tasks-durabletaskcontext-abcaba85/)
- [WaitAsync(CancellationToken)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskreference-1/methods/waitasync-system-threading-cancellationtoken-549e4d80/)
