Uri.Inequality(Uri, Uri) 연산자

정의

Uri 인스턴스의 값이 다른지 여부를 확인합니다.

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

uri2와 비교할 URI입니다.

uri2
Uri

uri1과 비교할 URI입니다.

반환

Boolean

Uri이 다르면 true이고, 그렇지 않으면 false입니다. 매개 변수 중 하나가 null이면 이 메서드에서 true를 반환합니다.

예제

이 예제에서는 문자열에서 세 Uri 개의 인스턴스를 만들고 비교하여 동일한 값을 나타내는지 여부를 확인합니다. Address2에서 Address3 찾을 Address2수 없는 항목이 포함되어 Query 있으므로 Address3 동일하지 않습니다. 결과는 콘솔에 기록됩니다.

// 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

설명

이 오버로드는 메서드를 Equals 사용하여 두 Uri 인스턴스가 동일하지 않은지 여부를 확인합니다. UserInfoFragment 비교를 수행할 때 콘텐츠가 무시됩니다.

적용 대상