# ResponseCompletionSource&lt;TResult&gt; Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/)

## AsValueTask {#asvaluetask-5258d391}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/asvaluetask-5258d391/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs#L127)

```csharp
public ValueTask<TResult> AsValueTask()
```

Returns this instance as a `System.Threading.Tasks.ValueTask-1`.

### Returns

This instance, as a `System.Threading.Tasks.ValueTask-1`.

## AsVoidValueTask {#asvoidvaluetask-1d9663d6}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/asvoidvaluetask-1d9663d6/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs#L133)

```csharp
public ValueTask AsVoidValueTask()
```

Returns this instance as a `System.Threading.Tasks.ValueTask`.

### Returns

This instance, as a `System.Threading.Tasks.ValueTask`.

## Complete {#complete-726f9a97}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/complete-726f9a97/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs#L232)

```csharp
public void Complete()
```

Sets the result to the default value.

## Complete(Response) {#complete-orleans-serialization-invocation-response-bf784f7d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/complete-orleans-serialization-invocation-response-bf784f7d/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs)

```csharp
public void Complete(Response value)
```

Sets the result.

### Parameters

- `value` (`Response`): The result value.

## Complete(Response&lt;TResult&gt;) {#complete-orleans-serialization-invocation-response-tresult-4c839004}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/complete-orleans-serialization-invocation-response-tresult-4c839004/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs)

```csharp
public void Complete(Response<TResult> value)
```

Completes this instance with a result.

### Parameters

- `value` (`Response<TResult>`): The result value.

## GetResult(short) {#getresult-short-25a9c567}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/getresult-short-25a9c567/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs#L237-L249)

```csharp
public TResult GetResult(short token)
```

Gets the result of the `System.Threading.Tasks.Sources.IValueTaskSource-1`.

### Parameters

- `token` (`short`): An opaque value that was provided to the `System.Threading.Tasks.ValueTask` constructor.

### Returns

The result of the `System.Threading.Tasks.Sources.IValueTaskSource-1`.

## GetStatus(short) {#getstatus-short-efb0a56c}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/getstatus-short-efb0a56c/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs#L136)

```csharp
public ValueTaskSourceStatus GetStatus(short token)
```

Gets the status of the current operation.

### Parameters

- `token` (`short`): Opaque value that was provided to the `System.Threading.Tasks.ValueTask`'s constructor.

### Returns

A value that indicates the status of the current operation.

## OnCompleted(Action&lt;object&gt;, object, short, ValueTaskSourceOnCompletedFlags) {#oncompleted-system-action-object-object-short-system-threading-tasks-sources-val-89763eba}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/oncompleted-system-action-object-object-short-system-threading-tasks-sources-val-89763eba/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs#L139)

```csharp
public void OnCompleted(Action<object> continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags)
```

Schedules the continuation action for this `System.Threading.Tasks.Sources.IValueTaskSource-1`.

### Parameters

- `continuation` (`Action<object>`): The continuation to invoke when the operation has completed.
- `state` (`object`): The state object to pass to `continuation` when it's invoked.
- `token` (`short`): An opaque value that was provided to the `System.Threading.Tasks.ValueTask` constructor.
- `flags` (`ValueTaskSourceOnCompletedFlags`): The flags describing the behavior of the continuation.

## Reset {#reset-d05879f9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/reset-d05879f9/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs#L146-L148)

```csharp
public void Reset()
```

Resets this instance.

## SetException(Exception) {#setexception-system-exception-0ed365b1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/setexception-system-exception-0ed365b1/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs#L154)

```csharp
public void SetException(Exception exception)
```

Completes this instance with an exception.

### Parameters

- `exception` (`Exception`): The exception.

## SetResult(TResult) {#setresult-tresult-153a4c19}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.invocation.responsecompletionsource-1/methods/setresult-tresult-153a4c19/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Invocation/ResponseCompletionSource.cs#L160)

```csharp
public void SetResult(TResult result)
```

Completes this instance with a result.

### Parameters

- `result` (`TResult`): The result.
