All pastes #2051411 Raw Edit

Untitled

public text v1 · immutable
#2051411 ·published 2011-04-28 02:53 UTC
rendered paste body
static int MyCounter (int[] myarray)
{
    if (myarray == null)
        throw new ArgumentNullException();
    for (int i = 1; i < myarray.Length; i++)
    {
        if (myarray[i - 1] > myarray[i])
            throw new ApplicationException("The array passed to the MyCounter function was not in ascending order.");
    }
    int counter = 0;
    for (int j = 0; j < myarray.Length; j++)
    {
        if (myarray[j] == 42 || myarray[j] == 1337 || myarray[j] == 3260)
            counter++;
    }
    return counter;
}