Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • C# Data Types
  • C# Decision Making
  • C# Methods
  • C# Delegates
  • C# Constructors
  • C# Arrays
  • C# ArrayList
  • C# String
  • C# Tuple
  • C# Indexers
  • C# Interface
  • C# Multithreading
  • C# Exception
Open In App
Next Article:
C# | Check if two HashSet<T> objects are equal
Next article icon

C# | Check if two SortedSet<T> objects are equal

Last Updated : 01 Feb, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
Equals(Object) Method which is inherited from the Object class is used to check if a specified SortedSet<T> object is equal to another SortedSet<T> object or not. Syntax:
public virtual bool Equals (object obj);
Here, obj is the object which is to be compared with the current object. Return Value: This method return true if the specified object is equal to the current object otherwise it returns false. Below programs illustrate the use of above-discussed method: Example 1: CSharp
// C# program to if a SortedSet object // is equal to another SortedSet object using System; using System.Collections.Generic;  class Geeks {      // Main Method     public static void Main(String[] args)     {          // Creating a SortedSet of strings         SortedSet<string> mySet = new SortedSet<string>();          // Inserting elements in SortedSet         mySet.Add("DS");         mySet.Add("C++");         mySet.Add("Java");         mySet.Add("JavaScript");          // Checking whether mySet is         // equal to itself or not         Console.WriteLine(mySet.Equals(mySet));     } } 
Output:
  True  
Example 2: CSharp
// C# program to if a SortedSet object // is equal to another SortedSet object using System; using System.Collections.Generic;  class Geeks {      // Main Method     public static void Main(String[] args)     {          // Creating a SortedSet of strings         SortedSet<string> mySet1 = new SortedSet<string>();          // Inserting elements in SortedSet         mySet1.Add("GeeksforGeeks");         mySet1.Add("Noida");         mySet1.Add("Data Structure");         mySet1.Add("Noida");          // Creating a SortedSet of integers         SortedSet<int> mySet2 = new SortedSet<int>();          // Inserting elements in SortedSet         for (int i = 0; i < 5; i++) {             mySet2.Add(i * 2);         }          // Checking whether mySet1 is         // equal to mySet2 or not         Console.WriteLine(mySet1.Equals(mySet2));          // Creating a SortedSet of integers         SortedSet<int> mySet3 = new SortedSet<int>();          // Assigning mySet2 to mySet3         mySet3 = mySet2;          // Checking whether mySet3 is         // equal to mySet2 or not         Console.WriteLine(mySet3.Equals(mySet2));     } } 
Output:
  False  True  
Note: If the current instance is a reference type, the Equals(Object) method checks for reference equality.

Next Article
C# | Check if two HashSet<T> objects are equal

K

Kirti_Mangal
Improve
Article Tags :
  • C#
  • CSharp-method
  • CSharp-Generic-SortedSet
  • CSharp-Generic-Namespace

Similar Reads

  • C# | Check if two SortedList objects are equal
    Equals(Object) Method which is inherited from the Object class is used to check whether the specified SortedList object is equal to another SortedList object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Return Value
    2 min read
  • C# | Check if two HashSet<T> objects are equal
    Equals(Object) Method which is inherited from the Object class is used to check if a specified HashSet<T> object is equal to another HashSet<T> object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Return
    2 min read
  • C# | Check if two Tuple Objects are equal
    A tuple is a data structure which gives you the easiest way to represent a data set. You can also check if the given tuple object is equal to the specified object or not using the Equals Method. This method will return true if the given tuple object is equal to the specified object, otherwise, retur
    2 min read
  • C# | Check if two List objects are equal
    Equals(Object) Method which is inherited from the Object class is used to check if a specified List<T> object is equal to another List<T> object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Return Value:
    2 min read
  • Check if two SortedDictionary objects are equal in C#
    Equals(Object) Method which is inherited from the Object class is used to check if a specified SortedDictionary object is equal to another SortedDictionary object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Return
    2 min read
  • C# | Check if two LinkedList<T> objects are equal
    Equals(Object) Method which is inherited from the Object class is used to check if a specified LinkedList<T> object is equal to another LinkedList<T> object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. R
    2 min read
  • C# | Check if two OrderedDictionary objects are equal
    Equals(Object) Method which is inherited from the Object class is used to check if a specified OrderedDictionary object is equal to another OrderedDictionary object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Retur
    2 min read
  • C# | Check if two StringCollection objects are equal
    Equals(Object) Method which is inherited from the Object class is used to check if a specified StringCollection object is equal to another StringCollection object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Return
    2 min read
  • C# | Check if two StringDictionary objects are equal or not
    Equals(Object) Method which is inherited from the Object class is used to check if a specified StringDictionary object is equal to another StringDictionary object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Return
    2 min read
  • C# | Check if two ListDictionary objects are equal
    Equals(Object) Method which is inherited from the Object class is used to check if a specified ListDictionary object is equal to another ListDictionary object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Return Valu
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences