问题描述
公用字符串categoryName(双类别)
{
字符串poolCategory0;
字符串poolCategory1;
字符串poolCategory2;
poolCategory0 =小";
poolCategory1 ="Medium";
poolCategory2 =大";
如果(类别< 500000)
{
lblCategory.Text = poolCategory0;
}
否则,如果(类别> = 500000和类别< 1500000)
{
public string categoryName(double category)
{
string poolCategory0;
string poolCategory1;
string poolCategory2;
poolCategory0 = "Small";
poolCategory1 = "Medium";
poolCategory2 = "Large";
if (category < 500000)
{
lblCategory.Text = poolCategory0;
}
else if (category >= 500000 & category < 1500000)
{
lblCategory.Text = poolCategory1;
}
其他
{
lblCategory.Text = poolCategory2;
}
lblCategory.Text = poolCategory1;
}
else
{
lblCategory.Text= poolCategory2;
}
对onclick进行编码,其中categoryName称为
code onclick where categoryName called
请帮助
推荐答案
问题可能出在您的方法categoryName声明它返回一个字符串值而没有.可以从更改签名公共字符串categoryName(double category)到 public void categoryName(double category)或在方法末尾返回一个字符串.
The problem probably is that your method categoryName declares that it returns a string value and it does not. Either change the signature frompublic string categoryName(double category) to public void categoryName(double category)or return a string at the end of the method.
Rgds MM
这篇关于并非所有代码路径都返回值错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!