# DurableTaskContext.RunEffect(TaskId, TState, Func&lt;TState, DurableTaskResponse&gt;)

[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#L853)

```csharp
protected internal virtual DurableTaskResponse RunEffect<TState>(TaskId effectId, TState state, Func<TState, DurableTaskResponse> effect)
```

Returns the outcome recorded for the effect `effectId`, or runs the effect and records its outcome.

### Parameters

- `effectId` (`TaskId`): The effect's identifier, a child of this execution.
- `state` (`TState`): The state which `effect` receives.
- `effect` (`Func<TState, DurableTaskResponse>`): Runs the effect and returns its outcome: its result, or the exception which it threw. It doesn't throw.

### Returns

The effect's outcome, which the host recorded.
