Type cast is redundant > target-type conditional expression not available in C# 7.3, use 9+
Completed
In a asp.mvc project .NET framework 4.6.1 I'm getting a lot of resharper "Type cast is redundant" suggestions to remove cast.
When I remove the type cast, I get an error saying target-type conditional expression not available in C# 7.3, use 9+.
The "C# Language Level" of the project is set to "Experimental".
Can I suppress the resharper messages somehow? Or is there a better solution?
Upload id: 2021_07_10_Fxm9RCHrabAPFuzr (file: 2021-07-10_10-38-04.png)
Please sign in to leave a comment.
Hello,
Please specify what "C# Language Level" is set in Properties window (select the correspondent project and press F4 to open the window)?
Thank you.
The "C# Language Level" of the project is set to "Experimental".
Could you please set it to Default and check if Type cast is redundant" suggestions still appear?
Setting project property "C# Language Level" to "Default (autodetect)" removes the "Type cast is redundant" warnings/suggestions.
Not sure what other, if any, implications this change will have...
Hello,
thank you for letting me know.
"Default" value should be the one selected by default. Not sure why it switched to "Experimental" in your case.
Anyway, please feel free to contact us in case of any questions or problems.