C# | Byte.Equals(Byte) Method Last Updated : 07 Feb, 2023 Comments Improve Suggest changes Like Article Like Report This method is used to return a value indicating whether this instance and a specified Byte object represent the same value. Syntax: public bool Equals (byte obj); Here, obj is a byte object to compare to this instance. Return Value: This method returns true if obj is equal to this instance otherwise, it returns false. Below programs illustrate the use of Byte.Equals(Byte) Method: Example 1: CSHARP // C# program to demonstrate // Byte.Equals(byte) Method using System; class GFG { // Main Method public static void Main() { // Declaring val1 and val2 byte val1, val2; // initializing the val1, val2 and val3 val1 = 12; val2 = 13; // getting compared constant // using Equals method bool i = val2.Equals(val1); // checking the condition if (i) Console.Write("val2 is equal to val1"); else Console.Write("val2 is not equal to val1"); } } Output:val2 is not equal to val1 Example 2: CSHARP // C# program to demonstrate // Byte.Equals(byte) Method using System; class GFG { // Main Method public static void Main() { // checking the condition // calling check() method check((byte)10, (byte)20); check((byte)30, (byte)20); check((byte)10, (byte)10); check((byte)5, (byte)7); check((byte)40, (byte)50); check((byte)1, (byte)1); } // Defining the check method public static void check(byte v1, byte v2) { // getting compared constant // using Equals() method bool i = v1.Equals(v2); // checking the condition if (i) Console.WriteLine(v1 + " is equal to " + v2); else Console.WriteLine(v1 + " is not equal to " + v2); } } Output:10 is not equal to 20 30 is not equal to 20 10 is equal to 10 5 is not equal to 7 40 is not equal to 50 1 is equal to 1 Reference: https://docs.microsoft.com/en-us/dotnet/api/system.byte.equals?view=netframework-4.7.2#System_Byte_Equals_System_Byte_ Comment More infoAdvertise with us Next Article C# | Byte.Equals(Byte) Method R rohitprasad3 Follow Improve Article Tags : C# CSharp-method CSharp-Byte-Struct Similar Reads C# | Byte.Equals(Object) Method This method is used to get a value which indicates 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 or null. Return Value: This method returns true if obj is an instance 2 min read C# | Byte.CompareTo(Byte) Method This method is used to compare this instance to a specified 8-bit unsigned integer and returns an indication of their relative values.Syntax: public int CompareTo (byte value); Here, the value is an 8-bit unsigned integer to compare.Return Value: This method returns a signed integer that indicates t 2 min read C# | Boolean.Equals(Boolean) Method This method is used to return a value indicating whether this instance is equal to a specified Boolean object.Syntax: public bool Equals (bool obj); Here, obj is a boolean value to compare to this instance.Return Value: This method returns true if obj has the same value as this instance otherwise it 2 min read C# | Char.Equals() Method In C#, Char.Equals() is a System.Char struct method which is used to return a value by checking whether current instance is equal to a specified object or Char value. This method can be overloaded by passing different type of arguments to it. Char.Equals(Char) Method Char.Equals(Object) Method Char. 3 min read C# | Byte.GetHashCode() Method This method is used to return the hash code for the given byte.Syntax: public override int GetHashCode (); Return Value: This method returns a hash code for the current Byte.Below programs illustrate the use of Byte.GetHashCode() Method:Example 1: CSHARP // C# program to demonstrate // Byte.GetHashC 2 min read Like