Table of Contents

Class IpAddress

Namespace
Trellis.Primitives
Assembly
Trellis.Primitives.dll

Represents an IP address (IPv4 or IPv6) as a value object.

[JsonConverter(typeof(ParsableJsonConverter<IpAddress>))]
public class IpAddress : ScalarValueObject<IpAddress, string>, IComparable<ValueObject>, IEquatable<ValueObject>, IConvertible, IScalarValue<IpAddress, string>, IParsable<IpAddress>
Inheritance
IpAddress
Implements
Inherited Members
Extension Methods

Remarks

Validates using TryParse(string, out IPAddress). Provides parsing and JSON serialization support.

Methods

Parse(string?, IFormatProvider?)

Parses an IP address.

public static IpAddress Parse(string? s, IFormatProvider? provider)

Parameters

s string
provider IFormatProvider

Returns

IpAddress

ToIPAddress()

Gets the underlying IPAddress.

public IPAddress ToIPAddress()

Returns

IPAddress

TryCreate(string?, string?)

Attempts to create an IP address.

public static Result<IpAddress> TryCreate(string? value, string? fieldName = null)

Parameters

value string
fieldName string

Returns

Result<IpAddress>

TryParse(string?, IFormatProvider?, out IpAddress)

Tries to parse an IP address.

public static bool TryParse(string? s, IFormatProvider? provider, out IpAddress result)

Parameters

s string
provider IFormatProvider
result IpAddress

Returns

bool