Show / Hide Table of Contents

    Class IPAddress

    Initializes a new instance of the IPAddress class.

    Inheritance
    Object
    IPAddress
    Inherited Members
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: System.Net
    Assembly: System.Net.dll
    Syntax
    [Serializable]
    public class IPAddress

    Constructors

    | Improve this Doc View Source

    IPAddress(Byte[])

    Initializes a new instance of the IPAddress class with the address specified as a Byte array.

    Declaration
    public IPAddress(byte[] address)
    Parameters
    Type Name Description
    Byte[] address
    Remarks

    The IPAddress is created with the Address property set to address. If the length of address is 4, IPAddress(Byte[]) constructs an IPv4 address; otherwise, an IPv6 address with a scope of 0 is constructed. The Byte array is assumed to be in network byte order with the most significant byte first in index position 0.

    Exceptions
    Type Condition
    ArgumentNullException

    address is null.

    ArgumentException

    address contains a bad IP address.

    | Improve this Doc View Source

    IPAddress(Int64)

    Initializes a new instance of the IPAddress class with the address specified as an Int64.

    Declaration
    public IPAddress(long newAddress)
    Parameters
    Type Name Description
    Int64 newAddress

    The long value of the IP address. For example, the value 0x2414188f in big-endian format would be the IP address "143.24.20.36".

    Remarks

    The IPAddress instance is created with the Address property set to newAddress. The Int64 value is assumed to be in network byte order.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    newAddress < 0 or newAddress > 0x00000000FFFFFFFF

    Fields

    | Improve this Doc View Source

    Any

    Provides an IP address that indicates that the server must listen for client activity on all network interfaces. This field is read-only.

    Declaration
    public static readonly IPAddress Any
    Field Value
    Type Description
    IPAddress
    | Improve this Doc View Source

    Loopback

    Provides the IP loopback address. This field is read-only.

    Declaration
    public static readonly IPAddress Loopback
    Field Value
    Type Description
    IPAddress

    Properties

    | Improve this Doc View Source

    AddressFamily

    Gets the address family of the IP address.

    Declaration
    public AddressFamily AddressFamily { get; }
    Property Value
    Type Description
    AddressFamily

    Returns InterNetwork for IPv4 or InterNetworkV6 for IPv6.

    Methods

    | Improve this Doc View Source

    Equals(Object)

    Compares two IP addresses.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    An IPAddress instance to compare to the current instance.

    Returns
    Type Description
    Boolean
    Overrides
    Object.Equals(Object)
    | Improve this Doc View Source

    GetAddressBytes()

    Provides a copy of the IPAddress as an array of bytes.

    Declaration
    public byte[] GetAddressBytes()
    Returns
    Type Description
    Byte[]

    A Byte array.

    | Improve this Doc View Source

    GetDefaultLocalAddress()

    Retrieves an IP address that is the local default address.

    Declaration
    public static IPAddress GetDefaultLocalAddress()
    Returns
    Type Description
    IPAddress

    The default IP address.

    | Improve this Doc View Source

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A hash code for the current object.

    Overrides
    Object.GetHashCode()
    | Improve this Doc View Source

    Parse(String)

    Converts an IP address string to an IPAddress instance.

    Declaration
    public static IPAddress Parse(string ipString)
    Parameters
    Type Name Description
    String ipString

    A string that contains an IP address in dotted-quad notation for IPv4 and in colon-hexadecimal notation for IPv6.

    Returns
    Type Description
    IPAddress

    An IPAddress instance.

    | Improve this Doc View Source

    ToString()

    Converts an Internet address to its standard notation.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A string that contains the IP address in either IPv4 dotted-quad or in IPv6 colon-hexadecimal notation.

    Overrides
    Object.ToString()
    Remarks

    The ToString() method converts the IP address that is stored in the Address property to either IPv4 dotted-quad or IPv6 colon-hexadecimal notation.

    Extension Methods

    LogDispatcher.GetCurrentClassLogger(Object)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018 nanoFramework Contributors
    Generated by DocFX