I have a C# solution with two console projects (macOS Island and Windows .NET) and a shared project. All projects use RTL.
I’m having an issue with this code:
// AsNumber is a double.
if (!Double.TryParse(s, out AsNumber)) {
AsNumber = Double.NaN;
}
This compiles fine for the .NET project but won’t compile for macOS with the error: Parenthesis required for call. If I add the parenthesis like this:
// AsNumber is a double.
if (!Double.TryParse(s, out AsNumber)) {
AsNumber = Double.NaN();
}
It compiles for macOS but not for .NET with the error: “const” is used as a method’.
Do I need to wrap this code with OS-specific #if
statements? I thought RTL would be able to figure this out but it looks like it can’t pick between NaN
and NaN()
.