0
我有一個問題,其中SonarQube認爲我的本地函數以函數作用域範圍內的變量賦值結束是無用的賦值。如何使用C#7.0定義清除此錯誤或在SonarQube中繞過它?SonarQube MsBuild,支持C#7.0本地函數?
我該如何解決這個問題?
功能定義:
public (bool, int) func(string str)
{
int variable = 0;
// C# 7.0 - Local Functions
void localFunc()
{
variable = 1; //SonarQube complains that this usless assignment needs to be removed
}
return (true, variable);
}