The AbstractIPAddressRange is an abstract implementation of IIPAddressRange. It is extended by both IPAddress Range, and Subnet.

Functionality Implementation


Extensions of AbstractIPAddressRange, depending on overrides and implementation, provide a general format (G, g, or empty string) that will express a range of IP addresses in a head - tail format for example -

AbstractIPAddressRange IFormattable Example
public void IFormattable_Example()
    // Arrange
    var head = IPAddress.Parse("");
    var tail = IPAddress.Parse("");
    var ipAddressRange = new IPAddressRange(head, tail);

    const string expected = " -";

    // Act
    var formattableString = string.Format("{0:g}", ipAddressRange);

    // Assert
    Assert.Equal(expected, formattableString);