title: Calculating a page number from list of IDs
body: <p>I'm paging some data, and I have a list of <code>long</code>s that contains the IDs of each element in the dataset. For now, I have something like this:</p>
  
  <pre><code>List&lt;long&gt; TheListOfIDs = {23,435,6635,4224,546,756,23,542....};
  </code></pre>
  
  <p><code>TheListOfIDs</code> actually contains thousands of IDs. Each page of data contains 20 elements. I'm writing a function that receives a <code>long</code> and returns the page number on which the ID is. In the sample data for instance, ID number <code>435</code> is in second position so it's part of the first 20 elements and therefore it's on page 1.</p>
  
  <p>If I write</p>
  
  <pre><code>int ThePageNumber = TheListOfIDs.IndexOf(TheID) / 20;
  </code></pre>
  
  <p>is this going to work in all cases? </p>
  
  <p>Update edit: each element in the list is unique and the ID passed in the function is in the list for sure!</p>