# 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/a3766e994fd2cba86c8ac60b8a80268cab7e6383/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/a3766e994fd2cba86c8ac60b8a80268cab7e6383/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`)
