title: SQl server TVF CLR function returns  row index?
body: <p>I have this simple C#  code which is used by Sql Server to return <code>TVF</code>: </p>
  
  <pre><code>[SqlFunction(FillRowMethodName = "FillRow3")]
  public static IEnumerable GetCsv(string csv)
  {
      string[] arr = csv.Split(',');
      return arr;
  }
  
  public static void FillRow3(Object obj, out int val, out int index)
  {
      val = int.Parse((string)obj) ;
      index =  ??? &lt;----------?
  }
  </code></pre>
  
  <p>Hoever - I  want to return a table which has 2 columns :  <code>( val,index)</code></p>
  
  <p>How can I return for each row , its index ( 0-based) according to <code>arr</code></p>
  
  <p>(<code>obj</code> is the <em>row</em> from <code>arr</code>.)</p>
  
  <p><em>p.s - 
  I can create an array of <code>MyItem</code> which will contain [value,index] in the <code>GetCsv</code> method.<br>
  And then  - obj row ( val+index) will be visible to <code>FillRow3</code> method.
  But I don't want to do that.</em></p>