有人理解 Sonarqube 中的这个错误吗?我们想要实现一个网格需求维度——给定一定数量的图片。2张图片是1X2网格,4张图片是2X2,6张图片是3X2等等。Sonarqube要求为这种简单的静态类实现Serialized。我该如何解决这个问题,有必要吗?
当前代码:
public class CardDimensionRequirement:Dictionary<int, CardDimensionRequirementLine>
{
public void AddItem(int PictureCount, int Length, int Height, int BootstrapDimension)
{
base.Add(PictureCount, new CardDimensionRequirementLine(PictureCount, Length, Height, BootstrapDimension));
}
public int GetMaxKey()
{
return base.Keys.Max();
}
}
static class CardDimensionRequirementSpecs
{
public static CardDimensionRequirement cardDimensionRequirementData;
static CardDimensionRequirementSpecs()
{
//int PictureCount, int Length, int Height, int BootstrapDimension
cardDimensionRequirementData = new CardDimensionRequirement();
cardDimensionRequirementData.AddItem(1, 1, 1, 1);
cardDimensionRequirementData.AddItem(2, 2, 1, 6);
cardDimensionRequirementData.AddItem(3, 3, 1, 4);
cardDimensionRequirementData.AddItem(4, 2, 2, 6);
cardDimensionRequirementData.AddItem(5, 3, 2, 4);
cardDimensionRequirementData.AddItem(6, 3, 2, 4);
}
}
慕标琳琳
相关分类