# InteractionFileCollection

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.6.0`
- Namespace: `Aspire.Hosting`
- Target framework: `net10.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting/IInteractionService.cs)
- Implements: [IEnumerable<InteractionFile>](/reference/api/csharp/aspire.hosting/interactionfile.md), [IReadOnlyCollection<InteractionFile>](/reference/api/csharp/aspire.hosting/interactionfile.md), [IReadOnlyList<InteractionFile>](/reference/api/csharp/aspire.hosting/interactionfile.md), `IEnumerable`, `IDisposable`

Represents the uploaded files associated with an interaction input.

## Definition

```csharp
namespace Aspire.Hosting;

public sealed class InteractionFileCollection
    : System.Collections.Generic.IEnumerable<Aspire.Hosting.InteractionFile>,
      System.Collections.Generic.IReadOnlyCollection<Aspire.Hosting.InteractionFile>,
      System.Collections.Generic.IReadOnlyList<Aspire.Hosting.InteractionFile>,
      System.Collections.IEnumerable,
      System.IDisposable
{
    // ...
}
```

## ATS metadata

### Ignored by ATS

- Reason: InteractionFileCollection owns server-local files and implements IDisposable, which is not ATS-compatible.

## Remarks

Dispose the collection when its files are no longer needed. Disposing the collection deletes the uploaded files from disk and prevents new content reads. Streams opened before disposal remain usable until those streams are disposed. Disposal is idempotent.

## Properties

- [Count](/reference/api/csharp/aspire.hosting/interactionfilecollection/properties.md#count) : `int` `get` -- Gets the number of uploaded files in the collection.

## Methods

- [Dispose](/reference/api/csharp/aspire.hosting/interactionfilecollection/methods.md#dispose) -- Deletes the uploaded files from disk and prevents new content reads. Streams that are already open remain usable until those streams are disposed.
- [GetEnumerator](/reference/api/csharp/aspire.hosting/interactionfilecollection/methods.md#getenumerator) : [IEnumerator<InteractionFile>](/reference/api/csharp/aspire.hosting/interactionfile.md) -- Returns an enumerator that iterates through the uploaded files.

## Indexers

- [this[int]](/reference/api/csharp/aspire.hosting/interactionfilecollection/indexers.md#this-int) : [InteractionFile](/reference/api/csharp/aspire.hosting/interactionfile.md) `get` -- Gets an uploaded file by its zero-based index.
