# ResolvedPort

- Kind: `struct`
- 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/ResolvedPort.cs)

Represents a resolved port with information about whether it was allocated or explicitly specified.

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public sealed readonly struct ResolvedPort
{
    // ...
}
```

## Properties

- [IsAllocated](/reference/api/csharp/aspire.hosting/resolvedport/properties.md#isallocated) : `bool` `get; init` -- Gets a value indicating whether the port was dynamically allocated. When true, the target environment may choose to ignore this port and use its own allocation mechanism. When false, the port was explicitly specified and should be used as-is.
- [IsImplicit](/reference/api/csharp/aspire.hosting/resolvedport/properties.md#isimplicit) : `bool` `get; init` -- Gets a value indicating whether the port was implicitly inferred from another value. When true, the port was derived (e.g., exposed port matching target port) rather than explicitly specified by the user.
- [Value](/reference/api/csharp/aspire.hosting/resolvedport/properties.md#value) : `int?` `get; init` -- Gets the port number, or null if no port was resolved.

## Methods

- [Allocated(int)](/reference/api/csharp/aspire.hosting/resolvedport/methods.md#allocated-int) : [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) `static` -- Creates a [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with an allocated port.
- [Explicit(int)](/reference/api/csharp/aspire.hosting/resolvedport/methods.md#explicit-int) : [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) `static` -- Creates a [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with an explicitly specified port.
- [Implicit(int)](/reference/api/csharp/aspire.hosting/resolvedport/methods.md#implicit-int) : [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) `static` -- Creates a [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with an implicitly inferred port.
- [None](/reference/api/csharp/aspire.hosting/resolvedport/methods.md#none) : [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) `static` -- Creates a [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with no port (null).
- [op_Implicit(ResolvedPort)](/reference/api/csharp/aspire.hosting/resolvedport/methods.md#op-implicit-resolvedport) : `int?` `static` -- Implicitly converts a [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) to a nullable int.
