# ParameterResource Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [ParameterResource](/reference/api/csharp/aspire.hosting/parameterresource.md)
- Kind: `Methods`
- Members: `2`

Represents a parameter resource.

## GetValueAsync(CancellationToken)

- Name: `GetValueAsync(CancellationToken)`
- Returns: `ValueTask<string?>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ParameterResource.cs#L117)

Gets the value of the parameter asynchronously, waiting if necessary for the value to be set.

```csharp
public class ParameterResource
{
    public ValueTask<string?> GetValueAsync(
        CancellationToken cancellationToken)
    {
        // ...
    }
}
```

## Parameters

- `cancellationToken` (`CancellationToken`)
  The cancellation token to observe while waiting for the value.

## Returns

`ValueTask<string?>` -- A task that represents the asynchronous operation, containing the value of the parameter.

## GetValueAsync(ValueProviderContext, CancellationToken)

- Name: `GetValueAsync(ValueProviderContext, CancellationToken)`
- Returns: `ValueTask<string?>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ParameterResource.cs#L117)

Gets the value of the parameter asynchronously, waiting if necessary for the value to be set.

```csharp
public class ParameterResource
{
    public ValueTask<string?> GetValueAsync(
        ValueProviderContext _,
        CancellationToken cancellationToken)
    {
        // ...
    }
}
```

## Parameters

- `_` ([ValueProviderContext](/reference/api/csharp/aspire.hosting/valueprovidercontext.md))
- `cancellationToken` (`CancellationToken`)
