×

C# Tutorial

Basics of .Net

C# Basics

C# Fundamentals

C# Operators

C# Loops

C# Type Conversions

C# Exception Handling

C# String Class

C# Arrays

C# List

C# Stack

C# Queue

C# Collections

C# Character Class

C# Class and Object

C# Namespaces

C# Delegates

C# Constructors

C# Inheritance

C# Operator Overloading

C# Structures

C# File Handling

C# Convert.ToInt32()

C# Int32 (int) Struct

C# DateTime Class

C# Uri Class

C# Database Connectivity

C# Windows

C# Other Topics

C# Q & A

C# Programs

C# Find O/P

Home » C#

C# | Uri.Inequality() Operator with Example

Uri.Inequality() Operator: Here, we are going to learn about the Equality() Operator of Uri class with example in C#.
Submitted by Nidhi, on March 26, 2020

Uri.Inequality() Operator

Uri.Inequality() Operator it returns true if two Uri objects do not contain the same Uri otherwise it returns false.

Syntax:

    bool operator != (Uri uri1, Uri uri2);

Parameter(s):

  • Uri uri1 – represents the first Uri to be compared.
  • Uri uri2 – represents the second Uri to be compared.

Return value:

The return type of this method is Boolean, it returns true if the two Uri instances are not equal; otherwise, false. If either parameter is null, this method returns true.

Example to demonstrate example of Uri.Inequality() Operator

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {
        // Create some Uri objects
        Uri uri1 = new Uri("https://www.includehelp.com/");
        Uri uri2 = new Uri("https://www.includehelp.com/");
        Uri uri3 = new Uri("https://www.includehelp.com/index.html");

        if (uri1 != uri2)
            Console.WriteLine("uri1 and uri2 are not equal");
        else
            Console.WriteLine("uri1 and uri2 are equal");

        if (uri1 != uri3)
            Console.WriteLine("uri1 and uri3 are not equal");
        else
            Console.WriteLine("uri1 and uri3 are equal");
    }
}

Output

uri1 and uri2 are equal
uri1 and uri3 are not equal

Reference: Uri.Inequality(Uri, Uri) Operator

Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.