C# Single Equality
Description
Single Equality
returns a value that indicates whether
two specified Single values are equal.
Syntax
Single.Equality
has the following syntax.
public static bool operator ==(
float left,
float right
)
Parameters
Single.Equality
has the following parameters.
left
- The first value to compare.right
- The second value to compare.
Returns
Single.Equality
method returns true if left and right are equal; otherwise, false.
Example
The Equality method defines the equality operator for Single values.
/*from w ww . ja v a 2 s . com*/
using System;
public class MainClass{
public static void Main(String[] argv){
float f1 = 1.2F;
float f2 = 1.2F;
Console.WriteLine(f1 == f2);
}
}
The code above generates the following result.