title: find the last occurrence of a value in an array vb
body: <p>I would like to find the reference of the last occurrence of a value within an array. </p>
  
  <p>The array has values in a format similar to <code>(0,7,7,7,7,7,14,15,15,15,15,15,15,16)</code>, with a boolean in the second column. </p>
  
  <p>I believe that FINDLAST is the function that I am looking for but I am unable to get the syntax to work.</p>
  
  <p>EDIT:</p>
  
  <p>I have the position of one of the occurrences within the array <code>CursorPosition</code> and from that I want to find the final occurrence within the array. My code is currently:</p>
  
  <pre><code>CursorPosition = position.FindLast(position, position(0, CursorPosition))
  </code></pre>
  
  <p>I am currently getting 3 errors:</p>
  
  <blockquote>
    <p>Type parameter 'T' for 'Public Shared Function FindLast(Of T)(array() As T, match As System.Predicate(Of T)) As T' cannot be inferred.</p>
    
    <p>Type argument inference failed for type parameter 'T' of 'Public Shared Function FindLast(Of T)(array() As T, match As System.Predicate(Of T)) As T'. Type argument could not be inferred from the argument passed to parameter 'array'.</p>
    
    <p>Type argument inference failed for type parameter 'T' of 'Public Shared Function FindLast(Of T)(array() As T, match As System.Predicate(Of T)) As T'. Type argument could not be inferred from the argument passed to parameter 'match'.</p>
  </blockquote>