Uri.Inequality(Uri, Uri) Operatore
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Determina se due istanze di Uri non hanno lo stesso valore.
public:
static bool operator !=(Uri ^ uri1, Uri ^ uri2);
public static bool operator != (Uri uri1, Uri uri2);
public static bool operator != (Uri? uri1, Uri? uri2);
static member op_Inequality : Uri * Uri -> bool
Public Shared Operator != (uri1 As Uri, uri2 As Uri) As Boolean
- uri1
- Uri
URI da confrontare con uri2
.
- uri2
- Uri
URI da confrontare con uri1
.
true
se le due istanze Uri non sono uguali; in caso contrario, false
. Se uno dei parametri è null
, questo metodo restituisce true
.
In questo esempio vengono create tre Uri istanze da stringhe e confrontate per determinare se rappresentano lo stesso valore. Address2
e Address3
non sono uguali perché Address3
contiene un Query oggetto non trovato in Address2
. Il risultato viene scritto nella 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 );
// 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)
Console.WriteLine("{0} is equal to {1}", address1.ToString(), address2.ToString());
// The second two are not equal.
if (address2 != address3)
Console.WriteLine("{0} is not equal to {1}", address2.ToString(), address3.ToString());
// Create some Uris.
let address1 = Uri "http://www.contoso.com/index.htm#search"
let address2 = Uri "http://www.contoso.com/index.htm"
let address3 = Uri "http://www.contoso.com/index.htm?date=today"
// The first two are equal because the fragment is ignored.
if address1 = address2 then
printfn $"{address1} is equal to {address2}"
// The second two are not equal.
if address2 <> address3 then
printfn $"{address2} is not equal to {address3}"
' 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
Questo overload usa il Equals metodo per determinare se le due Uri istanze non sono equivalenti. UserInfo e Fragment il contenuto vengono ignorati quando si effettua questo confronto.
Prodotto | Versioni |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |