I need to include double.TryParse(wordConf, out double wordConfDouble); in a script, but I get a feature out variable declaration is not available in c# 6 error message. Searching for it on Google, I can only see solutions for upgrading to C# 7 (which I am not allowed to do so in this project) so I wonder if someone could help me write an equivalent to this line that would work in any C# compiler.
You don't need to inline declare a type for out-parameters.
Replace:
double.TryParse(wordConf, out double wordConfDouble);
With:
double wordConfDouble;
double.TryParse(wordConf, out wordConfDouble);
It's just the inline declaration which is not supported in < C#7.0. Change your code to
double wordConfDouble;
double.TryParse(wordConf, out wordConfDouble);
Reference: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7#out-variables
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With