# InteractionInputCollection

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/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
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting/InteractionInputCollection`

## 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.
- [GetBoolean(string)](/reference/api/csharp/aspire.hosting/interactioninputcollection/methods.md#getboolean-string) : `bool` -- Gets the value of the input with the specified name as a `Boolean`.
- [GetDouble(string)](/reference/api/csharp/aspire.hosting/interactioninputcollection/methods.md#getdouble-string) : `double` -- Gets the value of the input with the specified name as a `Double`.
- [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.
- [GetInt32(string)](/reference/api/csharp/aspire.hosting/interactioninputcollection/methods.md#getint32-string) : `int` -- Gets the value of the input with the specified name as a `Int32`.
- [GetString(string)](/reference/api/csharp/aspire.hosting/interactioninputcollection/methods.md#getstring-string) : `string?` -- Gets the value of the input with the specified name as a string.
- [ToArray](/reference/api/csharp/aspire.hosting/interactioninputcollection/methods.md#toarray) : `InteractionInput[]` `ats export` -- Gets all inputs in declaration order.
- [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.
