Infinite Loop? Can't see why
<p>I have a function that takes in a roleID(as an int), and compares it to a multidimensional array to see if that array contains that roleID. if it does, it sets a bool to true and breaks. if it doesn't, the loop never exits. I'm hoping this is something stupid that I'm overlooking, but I've had a few different people look it over now. </p>

<p>The size of the userRoles array that I am testing with right now is 3. I can print userRoles.GetLength(0) and it says 3, and that matches whats in the database.</p>

<p>here's the code:</p>

<pre><code>public bool IsInRole(int roleID)
    {
        bool inRole = false;
        int i = userRoles.GetLength(0);
        for (int j = 0; j &lt; i; j++)
        {
            if (Convert.ToInt32(userRoles[j, 0]) == roleID)
            {
                inRole = true;
                break;
            }
        }
        return inRole;
    }
</code></pre>

<p>TIA,<br>
Chris</p>
