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.

class System.​Net.​IPAddress

Assembly: System.Net.Primitives

Inheritance: object → IPAddress

Provides an Internet Protocol (IP) address.

Fields and Constants

public static readonly IPAddress
Any
Provides an IP address that indicates that the server must listen for client activity on all network interfaces. This field is read-only.
public static readonly IPAddress
Broadcast
Provides the IP broadcast address. This field is read-only.
public static readonly IPAddress
IPv6Any
The <see cref="M:System.Net.Sockets.Socket.Bind(System.Net.EndPoint)" /> method uses the <see cref="F:System.Net.IPAddress.IPv6Any" /> field to indicate that a <see cref="T:System.Net.Sockets.Socket" /> must listen for client activity on all network interfaces.
public static readonly IPAddress
IPv6Loopback
Provides the IP loopback address. This property is read-only.
public static readonly IPAddress
IPv6None
Provides an IP address that indicates that no network interface should be used. This property is read-only.
public static readonly IPAddress
Loopback
Provides the IP loopback address. This field is read-only.
public static readonly IPAddress
None
Provides an IP address that indicates that no network interface should be used. This field is read-only.

Properties

public long
Address
An Internet Protocol (IP) address.
public AddressFamily
AddressFamily
Gets the address family of the IP address.
public bool
IsIPv4MappedToIPv6
Gets whether the IP address is an IPv4-mapped IPv6 address.
public bool
IsIPv6LinkLocal
Gets whether the address is an IPv6 link local address.
public bool
IsIPv6Multicast
Gets whether the address is an IPv6 multicast global address.
public bool
IsIPv6SiteLocal
Gets whether the address is an IPv6 site local address.
public bool
IsIPv6Teredo
Gets whether the address is an IPv6 Teredo address.
public bool
IsIPv6UniqueLocal
Gets whether the address is an IPv6 Unique Local address.
public long
ScopeId
Gets or sets the IPv6 address scope identifier.

Methods

public bool
Equals​(object comparand)
comparand An <see cref="T:System.Net.IPAddress" /> instance to compare to the current instance.
Returns <see langword="true" /> if the two addresses are equal; otherwise, <see langword="false" /> .
Compares two IP addresses.
public byte[]
GetAddressBytes​()
Returns A <see cref="T:System.Byte" /> array.
Provides a copy of the <see cref="T:System.Net.IPAddress" /> as an array of bytes in network order.
public int
GetHashCode​()
Returns An integer hash value.
Returns a hash value for an IP address.
public IPAddress
MapToIPv4​()
Returns Returns <see cref="T:System.Net.IPAddress" /> . An IPv4 address.
Maps the <see cref="T:System.Net.IPAddress" /> object to an IPv4 address.
public IPAddress
MapToIPv6​()
Returns Returns <see cref="T:System.Net.IPAddress" /> . An IPv6 address.
Maps the <see cref="T:System.Net.IPAddress" /> object to an IPv6 address.
public string
ToString​()
Returns A string that contains the IP address in either IPv4 dotted-quad or in IPv6 colon-hexadecimal notation.
Converts an Internet address to its standard notation.
public bool
TryFormat​(Span`1 destination, Int32& charsWritten)
public bool
TryFormat​(Span`1 utf8Destination, Int32& bytesWritten)
public bool
TryWriteBytes​(Span`1 destination, Int32& bytesWritten)
protected void
Finalize​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object