# InteractionInputCollection

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/IInteractionService.cs)
- Implements: [IEnumerable<InteractionInput>](/reference/api/csharp/aspire.hosting/interactioninput.md), [IReadOnlyCollection<InteractionInput>](/reference/api/csharp/aspire.hosting/interactioninput.md), [IReadOnlyList<InteractionInput>](/reference/api/csharp/aspire.hosting/interactioninput.md), `IEnumerable`

A collection of interaction inputs that supports both indexed and name-based access.

## Definition

```csharp
namespace Aspire.Hosting;

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

## Constructors

- [InteractionInputCollection(IReadOnlyList<InteractionInput>)](/reference/api/csharp/aspire.hosting/interactioninputcollection/constructors.md#constructor-ireadonlylist-interactioninput) -- Initializes a new instance of the [InteractionInputCollection](/reference/api/csharp/aspire.hosting/interactioninputcollection.md) class.

## Properties

- [Count](/reference/api/csharp/aspire.hosting/interactioninputcollection/properties.md#count) : `int` `get` -- Gets the number of inputs in the collection.
- [Names](/reference/api/csharp/aspire.hosting/interactioninputcollection/properties.md#names) : `IEnumerable<string>` `get` -- Gets the names of all inputs in the collection.

## Methods

- [ContainsName(string)](/reference/api/csharp/aspire.hosting/interactioninputcollection/methods.md#containsname-string) : `bool` -- Determines whether the collection contains an input with the specified name.
- [GetEnumerator](/reference/api/csharp/aspire.hosting/interactioninputcollection/methods.md#getenumerator) : [IEnumerator<InteractionInput>](/reference/api/csharp/aspire.hosting/interactioninput.md) -- Returns an enumerator that iterates through the collection.
- [TryGetByName(string, InteractionInput?)](/reference/api/csharp/aspire.hosting/interactioninputcollection/methods.md#trygetbyname-string-interactioninput) : `bool` -- Tries to get an input by its name.

## Indexers

- [this[string]](/reference/api/csharp/aspire.hosting/interactioninputcollection/indexers.md#this-string) : [InteractionInput](/reference/api/csharp/aspire.hosting/interactioninput.md) `get` -- Gets an input by its name.
- [this[int]](/reference/api/csharp/aspire.hosting/interactioninputcollection/indexers.md#this-int) : [InteractionInput](/reference/api/csharp/aspire.hosting/interactioninput.md) `get` -- Gets an input by its index.
