Table of Contents

Class Address

Namespace
L5Sharp.Common
Assembly
L5Sharp.dll

Provides a wrapper around the string port address value to indicate what type of address the value is.

public class Address
Inheritance
Address
Inherited Members

Constructors

Address(string)

Creates a new Address with the provided string value.

public Address(string address)

Parameters

address string

Exceptions

ArgumentNullException

Properties

IsEmpty

Indicates that the address value is an empty string.

public bool IsEmpty { get; }

Property Value

bool

IsHostName

Indicates whether the current Address is a host name address.

public bool IsHostName { get; }

Property Value

bool

true if the address value is a valid host name address; otherwise, false.

Remarks

A host name must start with a letter, contain only alpha-numeric characters or special characters '.' and '-', and have a maximum length of 64 characters.

IsIPv4

Indicates whether the current Address is a IPv4 address.

public bool IsIPv4 { get; }

Property Value

bool

true if the address value is a valid IPv4 address; otherwise, false.

IsSlot

Indicates whether the current Address is a slot number address.

public bool IsSlot { get; }

Property Value

bool

true if the address value is a valid byte address; otherwise, false.

None

Represents no address value, or an empty string.

public static Address None { get; }

Property Value

Address

Methods

DefaultIP()

Creates a new Address with the common default IP of 192.168.0.1.

public static Address DefaultIP()

Returns

Address

A Address with the default IP value.

DefaultSlot()

Creates a new Address with the default slot 0.

public static Address DefaultSlot()

Returns

Address

A Address with the default slot value.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

FromIP(IPAddress)

Creates a new Address instance from the provided IPAddress object.

public static Address FromIP(IPAddress ipAddress)

Parameters

ipAddress IPAddress

The IPAddress value that represents the port address.

Returns

Address

A new Address value from the provided IP.

Exceptions

ArgumentNullException

ipAddress is null.

FromSlot(byte)

Creates a new Address instance from the provided byte slot number value.

public static Address FromSlot(byte slot)

Parameters

slot byte

the byte number value that represents the port address.

Returns

Address

A new Address value from the provided slot number.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Slot(byte)

Creates a new Address with the specified slot number.

public static Address Slot(byte slot)

Parameters

slot byte

The slot number to create.

Returns

Address

ToIPAddress()

public IPAddress ToIPAddress()

Returns

IPAddress

Exceptions

InvalidOperationException

ToSlot()

public byte ToSlot()

Returns

byte

Exceptions

InvalidOperationException

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator ==(Address?, Address?)

Determines if the provided objects are equal.

public static bool operator ==(Address? left, Address? right)

Parameters

left Address

An object to compare.

right Address

An object to compare.

Returns

bool

true if the provided objects are equal; otherwise, false.

implicit operator byte(Address)

Converts the current Address to a string value.

public static implicit operator byte(Address address)

Parameters

address Address

The value to convert.

Returns

byte

A string representing the address value.

implicit operator string(Address)

Converts the current Address to a string value.

public static implicit operator string(Address address)

Parameters

address Address

The value to convert.

Returns

string

A string representing the address value.

implicit operator Address(byte)

Converts the current string to a Address value.

public static implicit operator Address(byte address)

Parameters

address byte

The value to convert.

Returns

Address

A Address representing the address value.

implicit operator Address(string)

Converts the current string to a Address value.

public static implicit operator Address(string address)

Parameters

address string

The value to convert.

Returns

Address

A Address representing the address value.

operator !=(Address?, Address?)

Determines if the provided objects are not equal.

public static bool operator !=(Address? left, Address? right)

Parameters

left Address

An object to compare.

right Address

An object to compare.

Returns

bool

true if the provided objects are not equal; otherwise, false.