Untitled
public text v1 · immutablestatic 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;
}