我正在使用Fusionchart,我需要标记轴。 它使用int但我需要一个轴的字符串
public int GetyAxisName(int chartId)
{
Chart_AttributeModel chart_AttributeModel = new Chart_AttributeModel();
List<Chart_Attribute> attributes = chart_AttributeModel.GetChart_AttributeByChart(chartId);
AttributeModel attributeModel = new AttributeModel();
int yAxisName = new int();
foreach (Chart_Attribute ca in attributes)
{
Attribute a = attributeModel.GetAttribute(ca.AID);
if (a.Name == "yAxisName")
{
yAxisName = Convert.ToInt32(ca.Value);
}
}
return yAxisName;
}
但是,如果我想将其更改为字符串,它就不起作用。 代码有什么问题?
public string GetyAxisName(int chartId)
{
Chart_AttributeModel chart_AttributeModel = new Chart_AttributeModel();
List<Chart_Attribute> attributes = chart_AttributeModel.GetChart_AttributeByChart(chartId);
AttributeModel attributeModel = new AttributeModel();
string yAxisName = new string();
foreach (Chart_Attribute ca in attributes)
{
Attribute a = attributeModel.GetAttribute(ca.AID);
if (a.Name == "yAxisName")
{
yAxisName = Convert.ToString(ca.Value);
}
}
return yAxisName;
}
由于
答案 0 :(得分:0)
唯一可见的错误是string yAxisName1 = new string();
String不包含带0参数的构造函数。所以把它string yAxisName1 = "";