Uri.Inequality(Uri, Uri) Operador

Definición

Determina si dos instancias de Uri no tienen el mismo valor.Determines whether two Uri instances do not have the same value.

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

Parámetros

uri1
Uri

Instancia de Uri que se va a comparar con uri2.A Uri instance to compare with uri2.

uri2
Uri

Instancia de Uri que se va a comparar con uri1.A Uri instance to compare with uri1.

Devoluciones

Valor Boolean que es true si las dos instancias de Uri no son iguales; en caso contrario, false.A Boolean value that is true if the two Uri instances are not equal; otherwise, false. Si alguno de los parámetros es null, este método devuelve true.If either parameter is null, this method returns true.

Ejemplos

En este ejemplo se crean tres instancias de Uri a partir de cadenas y se comparan para determinar si representan el mismo valor.This example creates three Uri instances from strings and compares them to determine whether they represent the same value. Address2 y Address3 no son los mismos porque Address3 contiene un Query que no se encuentra en Address2.Address2 and Address3 are not the same because Address3 contains a Query that is not found in Address2. El resultado se escribe en la consola.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 );
// 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.
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

Comentarios

Esta sobrecarga usa el método Equals para determinar si las dos instancias de Uri no son equivalentes.This overload uses the Equals method to determine whether the two Uri instances are not equivalent. el contenido de UserInfo y Fragment se omite al realizar esta comparación.UserInfo and Fragment content is ignored when making this comparison.

Se aplica a