C# Класс NetworkCommsDotNet.Tools.IPRange

A class that encapsulates an IPv4 or IPv6 range. Used for checking if an IPAddress is within an IPRange.
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
IPRange System
RecursivePopulate void

Открытые методы

Метод Описание
AllAddressesBetween ( IPAddress firstAddress, IPAddress lastAddress ) : List

Returns all IPAddresses that are between the provided addresses

AllAddressesInRange ( ) : List

Returns a list of all IPAddresses in the specified range

Contains ( IEnumerable ranges, IPAddress ipAddress ) : bool

Returns true if the provided IPAddress is within one of the provided IPRanges, otherwise false

Contains ( IPAddress ipAddress ) : bool

Returns true if this IPRange contains the provided IPAddress

Contains ( byte ipAddressBytes ) : bool

Returns true if this IPRange contains the provided IPAddress bytes

Contains ( string ipAddressStr ) : bool

Returns true if this IPRange contains the provided IPAddress

IPRange ( IPAddress address, IPAddress subnetmask ) : System

Initialise an IPRange using the provided address and subnet mask.

IPRange ( string rangeCIDR ) : System

Initialise an IPRange using the provided CIDR notation.

IsAutoAssignedAddress ( IPAddress ipAddress ) : bool

Returns true if the provided IPAddress is within one of the autoassigned ip ranges, otherwise false

ToString ( ) : string

Returns a clean ToString of the IPRange

Приватные методы

Метод Описание
IPRange ( ) : System
RecursivePopulate ( byte firstAddressBytes, byte lastAddressBytes, byte knownBytes, List result ) : void

Recursively populates the result list by looping over all address byte levels

Описание методов

AllAddressesBetween() публичный статический Метод

Returns all IPAddresses that are between the provided addresses
public static AllAddressesBetween ( IPAddress firstAddress, IPAddress lastAddress ) : List
firstAddress IPAddress
lastAddress IPAddress
Результат List

AllAddressesInRange() публичный Метод

Returns a list of all IPAddresses in the specified range
public AllAddressesInRange ( ) : List
Результат List

Contains() публичный статический Метод

Returns true if the provided IPAddress is within one of the provided IPRanges, otherwise false
public static Contains ( IEnumerable ranges, IPAddress ipAddress ) : bool
ranges IEnumerable The ranges to search
ipAddress IPAddress The IPAddress to find in ranges
Результат bool

Contains() публичный Метод

Returns true if this IPRange contains the provided IPAddress
public Contains ( IPAddress ipAddress ) : bool
ipAddress IPAddress The IPAddress to check
Результат bool

Contains() публичный Метод

Returns true if this IPRange contains the provided IPAddress bytes
public Contains ( byte ipAddressBytes ) : bool
ipAddressBytes byte The IPAddress bytes to check
Результат bool

Contains() публичный Метод

Returns true if this IPRange contains the provided IPAddress
public Contains ( string ipAddressStr ) : bool
ipAddressStr string The IPAddress to check
Результат bool

IPRange() публичный Метод

Initialise an IPRange using the provided address and subnet mask.
public IPRange ( IPAddress address, IPAddress subnetmask ) : System
address IPAddress The address range to create
subnetmask IPAddress The subnet mask that specifies the network-identifying portion of the address
Результат System

IPRange() публичный Метод

Initialise an IPRange using the provided CIDR notation.
public IPRange ( string rangeCIDR ) : System
rangeCIDR string IP range using CIDR notation, e.g. "192.168.1.0/24" contains 192.168.1.0 to 192.168.1.255
Результат System

IsAutoAssignedAddress() публичный статический Метод

Returns true if the provided IPAddress is within one of the autoassigned ip ranges, otherwise false
public static IsAutoAssignedAddress ( IPAddress ipAddress ) : bool
ipAddress IPAddress The IPAddress to find in ranges
Результат bool

ToString() публичный Метод

Returns a clean ToString of the IPRange
public ToString ( ) : string
Результат string