C# Byte Equals(Object)
Description
Byte Equals(Object)
returns a value indicating whether
this instance is equal to a specified object.
Syntax
Byte.Equals(Object)
has the following syntax.
public override bool Equals(
Object obj
)
Parameters
Byte.Equals(Object)
has the following parameters.
obj
- An object to compare with this instance, or null.
Returns
Byte.Equals(Object)
method returns true if obj is an instance of Byte and equals the value of this instance; otherwise,
false.
Example
The following code example determines whether the first Byte value is equal to the second Byte value, and whether the first Byte value is equal to the boxed version of the second Byte value.
using System;/*from w w w .jav a 2 s . c om*/
class Sample
{
public static void Main()
{
byte byteVal1 = 0x7f;
byte byteVal2 = 123;
object objectVal3 = byteVal2;
Console.WriteLine("byteVal1 = {0}, byteVal2 = {1}, objectVal3 = {2}\n",
byteVal1, byteVal2, objectVal3);
Console.WriteLine("byteVal1 equals byteVal2?: {0}", byteVal1.Equals(byteVal2));
Console.WriteLine("byteVal1 equals objectVal3?: {0}", byteVal1.Equals(objectVal3));
}
}