Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct System.​Net.​IPNetwork

Assembly: System.Net.Primitives

Represents an IP network with an <see cref="T:System.Net.IPAddress" /> containing the network prefix and an <see cref="T:System.Int32" /> defining the prefix length.

Properties

public IPAddress
BaseAddress
Gets the <see cref="T:System.Net.IPAddress" /> that represents the prefix of the network.
public int
PrefixLength
Gets the length of the network prefix in bits.

Methods

public bool
Contains​(IPAddress address)
address The <see cref="T:System.Net.IPAddress" /> to check.
Returns <see langword="true" /> if the <see cref="T:System.Net.IPAddress" /> is part of the network; otherwise, <see langword="false" /> .
Determines whether a given <see cref="T:System.Net.IPAddress" /> is part of the network.
public bool
Equals​(IPNetwork other)
other An object to compare with this object.
Returns <see langword="true" /> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <see langword="false" /> .
Indicates whether the current object is equal to another object of the same type.
public bool
Equals​(object obj)
obj The <see cref="T:System.Net.IPNetwork" /> instance to compare to this instance.
Returns <see langword="true" /> if <paramref name="obj" /> is an <see cref="T:System.Net.IPNetwork" /> instance and the networks are equal; otherwise <see langword="false" /> .
Determines whether two <see cref="T:System.Net.IPNetwork" /> instances are equal.
public int
GetHashCode​()
Returns An integer hash value.
Returns the hash code for this instance.
public string
ToString​()
Returns The <see cref="T:System.String" /> containing the <see cref="T:System.Net.IPNetwork" /> 's CIDR notation.
Converts the instance to a string containing the <see cref="T:System.Net.IPNetwork" /> 's CIDR notation.
public bool
TryFormat​(Span`1 destination, Int32& charsWritten)
public bool
TryFormat​(Span`1 utf8Destination, Int32& bytesWritten)
protected void
Finalize​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object