SByte.Equals Method in C# with Examples Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report SByte.Equals Method is used to get a value which indicates whether the current instance is equal to a specified object or SByte or not. There are 2 methods in the overload list of this method as follows: Equals(SByte) Method Equals(Object) Method SByte.Equals(SByte) Method This method is used to return a value indicating whether the current instance is equal to a specified SByte value or not. Syntax: public bool Equals (sbyte obj); Here, it takes a SByte value to compare to the current instance. Return Value: This method returns true if obj has the same value as this instance otherwise, false. Below programs illustrate the use of SByte.Equals(SByte) Method: Example 1: csharp // C# program to demonstrate the // SByte.Equals(SByte) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring and initializing value1 sbyte value1 = 42; // Declaring and initializing value2 sbyte value2 = 23; // using Equals(SByte) method bool status = value1.Equals(value2); // checking the status if (status) Console.WriteLine("{0} is equal to {1}", value1, value2); else Console.WriteLine("{0} is not equal to {1}", value1, value2); } } Output: 42 is not equal to 23 Example 2: csharp // C# program to demonstrate the // SByte.Equals(SByte) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // calling get() method get(78, 58); get(45, 45); get(10, 20); get(SByte.MaxValue, SByte.MinValue); } // defining get() method public static void get(sbyte value1, sbyte value2) { // using Equals(SByte) method bool status = value1.Equals(value2); // checking the status if (status) Console.WriteLine("{0} is equal to {1}", value1, value2); else Console.WriteLine("{0} is not equal to {1}", value1, value2); } } Output: 78 is not equal to 58 45 is equal to 45 10 is not equal to 20 127 is not equal to -128 SByte.Equals(Object) Method This method is used to returns a value indicating whether the current instance is equal to a specified object or not. Syntax: public override bool Equals (object obj); Here, it takes an object to compare with the current instance. Return Value: This method returns true if obj is an instance of SByte and equals the value of this instance otherwise, false. Below programs illustrate the use of the above-discussed method: Example 1: csharp // C# program to demonstrate the // SByte.Equals(Object) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring and initializing value1 sbyte value1 = 10; // Declaring and initializing value2 object value2 = 1 / 47; // using Equals(object) method bool status = value1.Equals(value2); // checking the status if (status) Console.WriteLine("{0} is equal to {1}", value1, value2); else Console.WriteLine("{0} is not equal to {1}", value1, value2); } } Output: 10 is not equal to 0 Example 2: csharp // C# program to demonstrate the // SByte.Equals(Object) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // calling get() method get(112, 85); get(124, 154); get(87, 87); get(54, 76); } // defining get() method public static void get(sbyte value1, object value2) { // compare both SByte value // using Equals(object) method bool status = value1.Equals(value2); // checking the status if (status) Console.WriteLine("{0} is equal to {1}", value1, value2); else Console.WriteLine("{0} is not equal to {1}", value1, value2); } } Output: 112 is not equal to 85 124 is not equal to 154 87 is not equal to 87 54 is not equal to 76 Reference: https://learn.microsoft.com/en-us/dotnet/api/system.sbyte.equals?view=netcore-2.1 Comment More infoAdvertise with us Next Article UInt16.Equals Method in C# with Examples K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-SByte-Struct Similar Reads Single.Equals() Method in C# with Examples Single.Equals() Method is used to get a value which indicates whether the two instances of Single represents the same value or not. There are 2 methods in the overload list of this method as follows: Equals(Single) Method Equals(Object) Method Single.Equals(Single) Method This method is used to retu 3 min read UInt32.Equals Method in C# with Examples UInt32.Equals Method is used to get a value which indicates whether the current instance is equal to a specified object or 32-bit unsigned integer or not. There are 2 methods in the overload list of this method as follows: Equals(UInt32) Method Equals(Object) Method UInt32.Equals(UInt32) Method This 3 min read UInt16.Equals Method in C# with Examples UInt16.Equals Method is used to get a value which indicates whether the current instance is equal to a specified object or 16-bit unsigned integer or not. There are 2 methods in the overload list of this method as follows: Equals(UInt16) Method Equals(Object) Method UInt16.Equals(UInt16) Method This 3 min read UInt64.Equals Method in C# with Examples UInt64.Equals Method is used to get a value which indicates whether the current instance is equal to a specified object or 64-bit unsigned long integer or not. There are 2 methods in the overload list of this method as follows: Equals(UInt64) Method Equals(Object) Method UInt64.Equals(UInt64) Method 3 min read Int16.Equals Method in C# with Examples Int16.Equals() Method is used to get a value which indicates whether the current instance is equal to a specified object or Int16. There are 2 methods in the overload list of this method which are as follows: Equals(Int16) Method Equals(Object) Method Int16.Equals(Int16) This method is used to retur 4 min read Int32.Equals Method in C# with Examples Int32.Equals() Method is used to get a value which indicates whether the current instance is equal to a specified object or Int32 or not. There are two methods in the overload list of this method as follows: Equals(Int32) Method Equals(Object) Method Int32.Equals(Int32) This method is used to return 3 min read Like