Appearance
CidrNetwork Class
Definition
Parsed IPv4 CIDR network with derived addressing details.
- Namespace:
JASE.Network - Assembly:
JASE.Network.dll
Properties
| Name | Description |
|---|---|
AddressCount | Total addresses in the block (including network and broadcast when reserved). |
BroadcastAddress | Broadcast address for the block (same as NetworkAddress for /32). |
FirstUsableAddress | First usable host address. |
LastUsableAddress | Last usable host address. |
NetworkAddress | Network (base) address after applying the prefix mask. |
PrefixLength | Prefix length in bits (0–32). |
SubnetMask | Subnet mask corresponding to PrefixLength. |
UsableHostCount | Number of usable host addresses in the block. |
Methods
| Name | Description |
|---|---|
bool Contains(IPAddress address) | Returns whether address falls within this network block (including network and broadcast addresses). |
IEnumerable<IPAddress> EnumerateUsableAddresses() | Lazily yields every usable host address in this network. |
bool Equals(CidrNetwork other) | |
bool Equals(object obj) | |
int GetHashCode() | |
bool op_Equality(CidrNetwork left, CidrNetwork right) | Equality comparison. |
bool op_Inequality(CidrNetwork left, CidrNetwork right) | Inequality comparison. |
CidrNetwork Parse(IPAddress address, IPAddress subnetMask) | Creates a network from an IPv4 address and subnet mask. |
CidrNetwork Parse(IPAddress address, int prefixLength) | Creates a network from an IPv4 address and prefix length. |
CidrNetwork Parse(string cidr) | Parses an IPv4 CIDR string. |
string ToString() | |
bool TryParse(string cidr, out CidrNetwork network) | Attempts to parse an IPv4 CIDR string. |
Remarks
Supports prefix-length form (10.107.48.0/24) and dotted-mask form (10.107.48.0/255.255.255.0). The supplied address is normalized to the network address for the prefix.
Usable-host semantics:
/32 — single host; first and last usable are that host./31 — both addresses are usable (RFC 3021)./0–/30 — classic network and broadcast reserved. Enumeration of usable addresses is lazy and only performed when EnumerateUsableAddresses is called.