Search Results for

    Show / Hide Table of Contents

    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
    object
    IPAddressRange
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    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 address resides within this ip address ranges and has not expired

    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 addressInfo was a valid address range meaning addressInfo contains a new IPAddressRange

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.