- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
namespace test
{
//public record P(double D);
class Program1
{
static void Main(string[] args)
{
//The differences between Double.Equals and Double==
Console.WriteLine(double.NaN.Equals(double.NaN)); //True
Console.WriteLine(double.NaN == double.NaN); // False
//The same is true for tuples!
Console.WriteLine((double.NaN, 1).Equals((double.NaN, 1))); // True
Console.WriteLine((double.NaN, 1) == (double.NaN, 1)); // False
//But records in C# 9 behave differently!
Console.WriteLine(new P(double.NaN).Equals(new P(double.NaN))); // True
Console.WriteLine(new P(double.NaN) == new P(double.NaN)); // True
}
}
}