Uri::Equality Operator (Uri^, Uri^)
.NET Framework (current version)
Determines whether two Uri instances 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 Uri instances are equivalent; otherwise, false.
This example creates three Uri instances from strings and compares them to determine whether they represent the same value. Address1 and Address2 are the same because the Fragment portion is ignored for this comparison. The outcome is written to the console.
// Create some Uris. Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" ); Uri^ address2 = gcnew Uri( "http://www.contoso.com/index.htm" ); Uri^ address3 = gcnew Uri( "http://www.contoso.com/index.htm?date=today" ); // The first two are equal because the fragment is ignored. if ( address1 == address2 ) Console::WriteLine( "{0} is equal to {1}", address1, address2 ); // The second two are not equal. if ( address2 != address3 ) Console::WriteLine( "{0} is not equal to {1}", address2, address3 );
Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Show: