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}
Inheritance
Inherited Members
Namespace: LemonEdge.Utils
Assembly: 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 |
---|---|
System.Nullable<System.DateTime> |
ValidIPAddress
The start IP Address for this range of addresses
Declaration
public IPAddress ValidIPAddress { get; set; }
Property Value
Type | Description |
---|---|
System.Net.IPAddress |
ValidIPAddressMax
The end IP Address for this range of addresses
Declaration
public IPAddress ValidIPAddressMax { get; set; }
Property Value
Type | Description |
---|---|
System.Net.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 |
---|---|---|
System.Net.IPAddress | address | The ip address to check to see if it resides within this range of ip addresses |
System.DateTimeOffset | currentTime | If the IPAddressRange has an expirey this is used to check if the range is still valid or not |
Returns
Type | Description |
---|---|
System.Boolean | 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 |
---|---|---|
System.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 |
---|---|
System.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 |
---|---|---|
System.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 |
---|---|
System.Boolean | True if the |