相关疑难解决方法(0)

C# - 代码分析2227混淆

我有一个类属性,如下所示:

public List<Recipe> RecipeList
{
    get { return this._recipeList; }

    set
    {
        this._recipeList = value;
        OnPropertyChanged("RecipeList");
    }
}
Run Code Online (Sandbox Code Playgroud)

在另一种方法中,我有以下参考上面的属性.

private void RecipeSearch()
{
            this.RecipeList = RecipeManagerService.SearchByUnit(SearchCriteria)
                               .Where(recipe => recipe.IsApproved == true && !recipe.IsHidden).ToList();
}
Run Code Online (Sandbox Code Playgroud)

代码分析正在发出CA 2227警告:通过删除setter将RecipeList更改为只读.谁能告诉我为什么?

c# code-analysis

5
推荐指数
1
解决办法
2398
查看次数

标签 统计

c# ×1

code-analysis ×1