Export (0) Print
Expand All

Uri.Inequality Operator

Determines whether two Uri instances do not have the same value.

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

'Declaration
Public Shared Operator <> ( _
	uri1 As Uri, _
	uri2 As Uri _
) As Boolean

Parameters

uri1
Type: System.Uri

A Uri instance to compare with uri2.

uri2
Type: System.Uri

A Uri instance to compare with uri1.

Return Value

Type: System.Boolean
A Boolean value that is true if the two Uri instances are not equal; otherwise, false. If either parameter is Nothing, this method returns true.

This overload uses the Equals method to determine whether the two Uri instances are not equivalent. UserInfo and Fragment content is ignored when making this comparison.

This example creates three Uri instances from strings and compares them to determine whether they represent the same value. Address2 and Address3 are not the same because Address3 contains a Query that is not found in Address2. The outcome is written to the console.

' Create some Uris. 
Dim address1 As New Uri("http://www.contoso.com/index.htm#search")
Dim address2 As New Uri("http://www.contoso.com/index.htm")
Dim address3 As New Uri("http://www.contoso.com/index.htm?date=today")

' The first two are equal because the fragment is ignored. 
If address1 = address2 Then
    Console.WriteLine("{0} is equal to {1}", address1.ToString(), address2.ToString())
End If  
' The second two are not equal. 
If address2 <> address3 Then
    Console.WriteLine("{0} is not equal to {1}", address2.ToString(), address3.ToString())
End If

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft