# ResolvedPort Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md)
- Kind: `Methods`
- Members: `5`

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

## Allocated(int)

- Name: `Allocated(int)`
- Modifiers: `static`
- Returns: [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ResolvedPort.cs#L41)

Creates a [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with an allocated port.

```csharp
public struct ResolvedPort
{
    public static ResolvedPort Allocated(
        int port)
    {
        // ...
    }
}
```

## Parameters

- `port` (`int`)
  The allocated port number.

## Returns

[ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) -- A [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with IsAllocated set to true.

## Explicit(int)

- Name: `Explicit(int)`
- Modifiers: `static`
- Returns: [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ResolvedPort.cs#L34)

Creates a [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with an explicitly specified port.

```csharp
public struct ResolvedPort
{
    public static ResolvedPort Explicit(
        int port)
    {
        // ...
    }
}
```

## Parameters

- `port` (`int`)
  The explicitly specified port number.

## Returns

[ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) -- A [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with IsAllocated set to false.

## Implicit(int)

- Name: `Implicit(int)`
- Modifiers: `static`
- Returns: [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ResolvedPort.cs#L48)

Creates a [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with an implicitly inferred port.

```csharp
public struct ResolvedPort
{
    public static ResolvedPort Implicit(
        int port)
    {
        // ...
    }
}
```

## Parameters

- `port` (`int`)
  The implicitly inferred port number.

## Returns

[ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) -- A [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with IsImplicit set to true.

## None

- Name: `None`
- Modifiers: `static`
- Returns: [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ResolvedPort.cs#L54)

Creates a [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with no port (null).

```csharp
public struct ResolvedPort
{
    public static ResolvedPort None()
    {
        // ...
    }
}
```

## Returns

[ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) -- A [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) with Value set to null.

## op_Implicit(ResolvedPort)

- Name: `op_Implicit(ResolvedPort)`
- Modifiers: `static` `nullable`
- Returns: `int?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ResolvedPort.cs#L59)

Implicitly converts a [ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md) to a nullable int.

```csharp
public struct ResolvedPort
{
    public static implicit operator int?(
        ResolvedPort resolvedPort)
    {
        // ...
    }
}
```

## Parameters

- `resolvedPort` ([ResolvedPort](/reference/api/csharp/aspire.hosting/resolvedport.md))
