title: LINQ in IronPython
body: <p>I have a question about usage method in IronPython. Let's say I have some collection and then I create IronPython anonymous type from that collection and I want to iterate all over that collection. My code looks like this:</p>
  
  <pre><code>listInt = List[int]([0, 1, 2, 3, 4])
  firstCollection = listInt.Select(lambda(v): type('SomeType', (object,),{"TypeValue": v*v, "TypeIndex": v})())
  enumeratorFirst = IEnumerable[object].GetEnumerator(firstCollection)
  while enumeratorFirst.MoveNext():
      item = enumeratorFirst.Current
  </code></pre>
  
  <p>This code works fine. But when I use Select method with index incorporating, then I get error: 'int' object is not iterable. <a href="https://i.stack.imgur.com/P5ZKq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P5ZKq.png" alt="Error"></a></p>
  
  <p>My code looks like this:</p>
  
  <pre><code>listInt = List[int]([0, 1, 2, 3, 4])
  secondCollection = listInt.Select(lambda(v, i): type('SomeType', (object,), {"TypeValue": v*v, "TypeIndex": i})())
  enumeratorSecond = IEnumerable[object].GetEnumerator(secondCollection)
  while enumeratorSecond.MoveNext():
      item = enumeratorSecond.Current
  </code></pre>
  
  <p>Can anyone provide me with some help? Why there is error in second case?</p>
  
  <p>P.S.: For interface usage I looked here: <a href="http://lists.ironpython.com/pipermail/users-ironpython.com/2007-March/004663.html" rel="nofollow noreferrer">Interface In IronPython.</a>  For anonymous type usage I looked here: <a href="http://www.hydrogen18.com/blog/python-anonymous-objects.html" rel="nofollow noreferrer">Anonymous objects in Python.</a></p>