Class IPAddressRange
Parses an ip address range for checking to see if a supplied ip address is valid within that range.
Formats:
ipaddress{optional comment}
ipaddresMmin-ipaddressMax(optional expirey date){optional comment}
Inherited Members
Namespace: LemonEdge.Utils
Assembly: LemonEdge.Utils.dll
Syntax
public class IPAddressRange
Properties
ExpireyDate
An optional date this IP Address is no longer valid from
Declaration
public DateTime? ExpireyDate { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
ValidIPAddress
The start IP Address for this range of addresses
Declaration
public IPAddress ValidIPAddress { get; set; }
Property Value
| Type | Description |
|---|---|
| IPAddress |
ValidIPAddressMax
The end IP Address for this range of addresses
Declaration
public IPAddress ValidIPAddressMax { get; set; }
Property Value
| Type | Description |
|---|---|
| IPAddress |
Methods
IsValidAddress(IPAddress, DateTimeOffset)
Checks that the specified address is valid for being within this IPAddress Range
Declaration
public bool IsValidAddress(IPAddress address, DateTimeOffset currentTime)
Parameters
| Type | Name | Description |
|---|---|---|
| IPAddress | address | The ip address to check to see if it resides within this range of ip addresses |
| DateTimeOffset | currentTime | If the IPAddressRange has an expirey this is used to check if the range is still valid or not |
Returns
| Type | Description |
|---|---|
| bool | True if the given |
Parse(string)
Parses a string of an IPAddress range, returning a valid IPAddressRange if it is
Declaration
public static IPAddressRange Parse(string addressInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| string | addressInfo | The IPAddress range to parse. Formats: ipaddress{optional comment} ipaddresMmin-ipaddressMax(optional expirey date){optional comment} |
Returns
| Type | Description |
|---|---|
| IPAddressRange | A new valid IPAddressRange |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Throws an exception if the IPAddressRange can not be parsed correctly |
TryParse(string, out IPAddressRange)
Parses a string of an IPAddress range, returning if the string is valid or not and passing out a valid IPAddressRange if it is
Declaration
public static bool TryParse(string addressInfo, out IPAddressRange result)
Parameters
| Type | Name | Description |
|---|---|---|
| string | addressInfo | The IPAddress range to parse. Formats: ipaddress{optional comment} ipaddresMmin-ipaddressMax(optional expirey date){optional comment} |
| IPAddressRange | result | If the IPAddressRange is valid this passes out the IPAddressRange as an out parameter |
Returns
| Type | Description |
|---|---|
| bool | True if the |