有没有一种更简单的方法可以根据 C# .NET2 中的 int 值返回一个字符串?
if (intRelatedItems == 4)
{
_relatedCategoryWidth = "3";
}
else if (intRelatedItems == 3)
{
_relatedCategoryWidth = "4";
}
else if (intRelatedItems == 2)
{
_relatedCategoryWidth = "6";
}
else if (intRelatedItems == 1)
{
_relatedCategoryWidth = "12";
}
else
{
_relatedCategoryWidth = "0";
}