# DockerfileStatement Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [DockerfileStatement](/reference/api/csharp/aspire.hosting/dockerfilestatement.md)
- Kind: `Methods`
- Members: `1`

Represents a statement that can be written to a Dockerfile.

## WriteStatementAsync(StreamWriter, CancellationToken)

- Name: `WriteStatementAsync(StreamWriter, CancellationToken)`
- Modifiers: `abstract`
- Returns: `Task`

Writes the statement to the specified writer.

```csharp
public abstract class DockerfileStatement
{
    public abstract Task WriteStatementAsync(
        StreamWriter writer,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `writer` (`StreamWriter`)
  The writer to write to.
- `cancellationToken` (`CancellationToken`) `optional`
  A cancellation token.

## Returns

`Task` -- A task representing the asynchronous write operation.
