Partager via


IPAddress.IsLoopback Method

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

Indicates whether the specified IP address is the loopback address.

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

Syntax

'Declaration
Public Shared Function IsLoopback ( _
    address As IPAddress _
) As Boolean
public static bool IsLoopback(
    IPAddress address
)

Parameters

Return Value

Type: System.Boolean
true if address is the loopback address; otherwise, false.

Exceptions

Exception Condition
ArgumentNullException

The address parameter is nulla null reference (Nothing in Visual Basic).

Remarks

The IsLoopback method compares address to Loopback when the AddressFamily property is InterNetworkV6 and returns true if the two IPv6 addresses are the same.

In the case of IPv4, that the IsLoopback method returns true for any IP address of the form 127.X.Y.Z (where X, Y, and Z are in the range 0-255), not just Loopback (127.0.0.1).

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.