# DurableTask.RunInline(string, Func&lt;TResult&gt;)

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

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTask.RunInline.cs)

```csharp
public static TResult RunInline<TResult>(string name, Func<TResult> effect)
```

Runs `effect` in the caller's current work item before returning, with no suspension and no child execution, and records its outcome in the same journal write as the journaled state which it changes. A replay returns the recorded outcome without running `effect`.

### Parameters

- `name` (`string`): The effect's name within the running task, which identifies the effect as `WithId` identifies a step: the first occurrence of a name in one run is `name`, and later occurrences append their order, such as `name$2`, so an effect in a loop keeps one name. Effects and steps share one count per name, and an earlier run's step under the effect's identifier is a divergence. Names don't contain `$`.
- `effect` (`Func<TResult>`): The synchronous effect, which returns every value the body uses.

### Returns

The result which the effect returned when it ran.

### Exceptions

- `System.ArgumentNullException`: `name` or `effect` is `null`.
- `System.ArgumentException`: `name` is empty or contains `$`.
- `System.InvalidOperationException`: The host can't record the effect from the calling code, for example after `ConfigureAwait(false)`.
- `Orleans.Durable.Tasks.DurableTaskAttemptCanceledException`: The host canceled the attempt, for example with [DurableTaskAttemptCancellationReason](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskattemptcancellationreason/) because an earlier run recorded another kind of operation, such as a step, under the effect's identifier.
- `System.NotSupportedException`: `TResult` is an asynchronous operation, such as a `System.Threading.Tasks.Task`, a `System.Threading.Tasks.ValueTask`, or a [DurableTask](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletask/), or the host doesn't support recorded effects.

### Examples

```csharp
var summary = DurableTask.RunInline("pay", () => SetStatus(OrderStatus.Paid));
            var paymentId = DurableTask.RunInline("payment-id", Guid.NewGuid);
```
