共用方式為


IPAddress Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Provides an Internet Protocol (IP) address.

Inheritance Hierarchy

System.Object
  System.Net.IPAddress

Namespace:  System.Net
Assembly:  System.Net (in System.Net.dll)

Syntax

'Declaration
Public Class IPAddress
public class IPAddress

The IPAddress type exposes the following members.

Constructors

  Name Description
Public methodSupported by Silverlight for Windows Phone IPAddress(array<Byte[]) Initializes a new instance of the IPAddress class with the address specified as a Byte array.
Public methodSupported by Silverlight for Windows Phone IPAddress(Int64) Initializes a new instance of the IPAddress class with the address specified as an Int64.
Public methodSupported by Silverlight for Windows Phone IPAddress(array<Byte[], Int64) Initializes a new instance of the IPAddress class with an IPv6 address specified as a Byte array and the specified scope identifier.

Top

Properties

  Name Description
Public propertySupported by Silverlight for Windows Phone Address Obsolete. Gets or sets an Internet Protocol (IP) address for IPv4.
Public propertySupported by Silverlight for Windows Phone AddressFamily Gets the address family of the IP address.
Public propertySupported by Silverlight for Windows Phone IsIPv6LinkLocal Gets whether the address is an IPv6 link local address.
Public propertySupported by Silverlight for Windows Phone IsIPv6Multicast Gets whether the address is an IPv6 multicast global address.
Public propertySupported by Silverlight for Windows Phone IsIPv6SiteLocal Gets whether the address is an IPv6 site local address.
Public propertySupported by Silverlight for Windows Phone ScopeId Gets or sets the IPv6 address scope identifier.

Top

Methods

  Name Description
Public methodSupported by Silverlight for Windows Phone Equals Compares two IP addresses. (Overrides Object.Equals(Object).)
Protected methodSupported by Silverlight for Windows Phone Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetAddressBytes Provides a copy of the IPAddress as an array of bytes.
Public methodSupported by Silverlight for Windows Phone GetHashCode Returns a hash value for an IP address. (Overrides Object.GetHashCode().)
Public methodSupported by Silverlight for Windows Phone GetType Gets the Type of the current instance. (Inherited from Object.)
Public methodStatic memberSupported by Silverlight for Windows Phone HostToNetworkOrder(Int16) Converts a short value from host byte order to network byte order.
Public methodStatic memberSupported by Silverlight for Windows Phone HostToNetworkOrder(Int32) Converts an integer value from host byte order to network byte order.
Public methodStatic memberSupported by Silverlight for Windows Phone HostToNetworkOrder(Int64) Converts a long value from host byte order to network byte order.
Public methodStatic memberSupported by Silverlight for Windows Phone IsLoopback Indicates whether the specified IP address is the loopback address.
Protected methodSupported by Silverlight for Windows Phone MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic memberSupported by Silverlight for Windows Phone NetworkToHostOrder(Int16) Converts a short value from network byte order to host byte order.
Public methodStatic memberSupported by Silverlight for Windows Phone NetworkToHostOrder(Int32) Converts an integer value from network byte order to host byte order.
Public methodStatic memberSupported by Silverlight for Windows Phone NetworkToHostOrder(Int64) Converts a long value from network byte order to host byte order.
Public methodStatic memberSupported by Silverlight for Windows Phone Parse Converts an IP address string to an IPAddress instance.
Public methodSupported by Silverlight for Windows Phone ToString Converts an Internet address to its standard notation. (Overrides Object.ToString().)
Public methodStatic memberSupported by Silverlight for Windows Phone TryParse Determines whether a string is a valid IP address.

Top

Fields

  Name Description
Public fieldStatic memberSupported by Silverlight for Windows Phone Any Provides an IPv4 address that indicates that a server must listen for client activity on all network interfaces for IPv4. This field is read-only.
Public fieldStatic memberSupported by Silverlight for Windows Phone Broadcast Provides the IPv4 broadcast address. This field is read-only.
Public fieldStatic memberSupported by Silverlight for Windows Phone IPv6Any Provides an IPv6 address that indicates that a server must listen for client activity on all network interfaces for IPv6. This field is read-only.
Public fieldStatic memberSupported by Silverlight for Windows Phone IPv6Loopback Provides the IP loopback address. This property is read-only.
Public fieldStatic memberSupported by Silverlight for Windows Phone IPv6None Provides an IPv6 address that indicates that no network interface should be used. This property is read-only.
Public fieldStatic memberSupported by Silverlight for Windows Phone Loopback Provides the IPv4 loopback address. This field is read-only.
Public fieldStatic memberSupported by Silverlight for Windows Phone None Provides an IP address that indicates that no network interface should be used. This field is read-only.

Top

Remarks

The IPAddress class contains the address of a computer on an IP network. This class can be used to represent either an IPv4 or IPv6 address.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference