Uri.Inequality Operator
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Determines whether two Uri instances do not have the same value.
Assembly: System (in System.dll)
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.BooleanA Boolean value that is true if the two Uri instances are not equal; otherwise, false. If either parameter is null, this method returns true.
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. Uri address1 = new Uri("http://www.contoso.com/index.htm#search"); Uri address2 = new Uri("http://www.contoso.com/index.htm"); Uri address3 = new Uri("http://www.contoso.com/index.htm?date=today"); // The first two are equal because the fragment is ignored. if (address1 == address2) { outputBlock.Text += address1.ToString(); outputBlock.Text += " is equal to "; outputBlock.Text += address1.ToString(); outputBlock.Text += "\n"; } // The second two are not equal. if (address2 != address3) { outputBlock.Text += address2.ToString(); outputBlock.Text += " is not equal to "; outputBlock.Text += address3.ToString(); outputBlock.Text += "\n"; }
Show: