static class Util
{
static Random ran = new Random();
public static List<Point3d> RandomptGenerator(int num)
{
List <Point3d> ptList = new List<Point3d>();
int count = num;
for (int i = 0;i < count;i++)
{
for (int j = 0;j < count;j++)
{
double x = i;
double y = j;
x = ran.Next(0, 40);
y = ran.Next(0, 30);
ptList.Add(new Point3d(x, y, 0.0));
return ptList;
}
}
}
}
傢伙嗨,C#方法錯誤:檢測不到的代碼,而不是所有的代碼路徑返回一個值」
我收到以下錯誤,當我嘗試編譯這段代碼:
- 無法訪問代碼檢測
- 並非所有的代碼路徑返回一個值
我無法弄清楚這是爲什麼HAP pening ...任何幫助將不勝感激。 謝謝!
'返回ptList;'也許應該是在方法 –
看看那裏你return語句的結束 –