I faced the error mentioned in the title when doing my homework, and simply can't find a way to remove it. Here is the method that I have this problem with:

public static double LaskeMiidi(double[] luvut)
{
    double ka = Keskiarvo(luvut);
    double miidi = luvut[0];

    for (int i = 0; i &lt; luvut.Length; i++)
    {
        if (luvut[i] - ka &lt; luvut[i + 1] - ka) // The line error points to!
        {
            miidi = luvut[i];
        }
        else
        {
            miidi = luvut[i + 1];
        }
    }
    return miidi;
}


So basically the problem is that when I say luvut[i + 1], at some point this index might become more than the length of the array is. I just can't figure out any ways to solve this problem, since I'm only a beginner with programming.


Question: Why does resizing PNG with alpha transparency make edges gray?
Answer: There is a difference between how the transparency of the various PNG versions semi-transparent pixels are handled. If you resize and save the PNG to a different version than the original I guess it is possible that the semi transparent pixels were handled differently (ie matte) resulting in the difference you see. I'm not super conversant in any of this but if you are interested.

A Basic Explanation

If you want to dive into the geekiness there are a few really great items on SmashingMagazine's site that also touch on transparency.

There's a second part to this last one but I lack enough reputation to post additional links.