# DurableTaskContext.TryGetCurrent(DurableTaskContext?)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/methods/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L84-L85)

```csharp
public static bool TryGetCurrent(out DurableTaskContext? context)
```

Gets the context of the durable task which the calling code runs in, if any.

### Parameters

- `context` (`DurableTaskContext?`): The running task's context, or `null` outside a durable task.

### Returns

`true` when the calling code runs in a durable task.
