# NetworkEndpointSnapshotList

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

Holds a list of [NetworkEndpointSnapshot](/reference/api/csharp/aspire.hosting/networkendpointsnapshot.md) for an Endpoint, providing thread-safe enumeration and addition.

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public class NetworkEndpointSnapshotList
    : System.Collections.Generic.IEnumerable<Aspire.Hosting.ApplicationModel.NetworkEndpointSnapshot>,
      System.Collections.IEnumerable
{
    // ...
}
```

## Constructors

- [NetworkEndpointSnapshotList](/reference/api/csharp/aspire.hosting/networkendpointsnapshotlist/constructors.md#constructor)

## Methods

- [AddOrUpdateAllocatedEndpoint(NetworkIdentifier, AllocatedEndpoint)](/reference/api/csharp/aspire.hosting/networkendpointsnapshotlist/methods.md#addorupdateallocatedendpoint-networkidentifier-allocatedendpoint) -- Adds or updates an AllocatedEndpoint value associated with a specific network in the snapshot list.
- [GetAllocatedEndpointAsync(NetworkIdentifier, CancellationToken)](/reference/api/csharp/aspire.hosting/networkendpointsnapshotlist/methods.md#getallocatedendpointasync-networkidentifier-cancellationtoken) : [Task<AllocatedEndpoint>](/reference/api/csharp/aspire.hosting/allocatedendpoint.md) -- Gets an AllocatedEndpoint for a given network ID, waiting for it to appear if it is not already present.
- [GetEnumerator](/reference/api/csharp/aspire.hosting/networkendpointsnapshotlist/methods.md#getenumerator) : [IEnumerator<NetworkEndpointSnapshot>](/reference/api/csharp/aspire.hosting/networkendpointsnapshot.md) -- Provides a thread-safe enumerator over the network endpoint snapshots.
- [TryAdd(NetworkIdentifier, ValueSnapshot<AllocatedEndpoint>)](/reference/api/csharp/aspire.hosting/networkendpointsnapshotlist/methods.md#tryadd-networkidentifier-valuesnapshot-allocatedendpoint) : `bool` `obsolete` -- Adds an AllocatedEndpoint snapshot for a specific network if one does not already exist.
