C# Int16 Equals(Int16)
Description
Int16 Equals(Int16)
returns a value indicating whether
this instance is equal to a specified Int16 value.
Syntax
Int16.Equals(Int16)
has the following syntax.
public bool Equals(
short obj
)
Parameters
Int16.Equals(Int16)
has the following parameters.
obj
- An Int16 value to compare to this instance.
Returns
Int16.Equals(Int16)
method returns true if obj has the same value as this instance; otherwise, false.
Example
The following code example demonstrates the Equals method.
using System;//from w w w . j a v a 2 s. c om
class Sample
{
public static void Main()
{
Int16 c1 = -2, c2 = 2;
try {
Console.WriteLine(c1.Equals(c2));
}catch (Exception e){
Console.WriteLine(e);
}
}
}
The code above generates the following result.