static bool BoxDiscovery(h) {
...
//I've acquired bmp by this point in the ellipses above
for (int v = 211; v < 661; v++) {
Color c = bmp.GetPixel(h, v);
if (c.R > 221 && c.G < 153)
//if c.r > 221 && c.G < 153 get me out of this crazy
// thing Jane and return true, else false without the
// compiler throwing an 'Unreachable code detected'.
// Use break or anything you want.
...
}
}
}
我今天感觉特别愚蠢。
答案 0 :(得分:5)
static bool BoxDiscovery(h)
{
for (int v = 211; v < 661; v++)
{
Color c = bmp.GetPixel(h, v);
if (c.R > 221 && c.G < 153)
{
return true;
}
}
// Make sure you provide a default value here
// If we reach this point your condition hasn't been
// satisfied meaning that no box has been found
// so you can safely return false
return false;
}