Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not really sure what you are asking of but the <code>Select</code> iterates over the list starting at index 0. If the value of the element at the current index is equal to the index it will set the <code>InPlace</code> property in the anonymous object to true. My guess is that the code above prints true for 3, 6 and 7, right?</p> <p>It would also make it easier to explain if you write what you don't understand.</p> <p>Jon Skeet has written a series of blog post where he implement linq, read about <code>Select</code> here: <a href="http://msmvps.com/blogs/jon_skeet/archive/2010/12/23/reimplementing-linq-to-objects-part-3-quot-select-quot-and-a-rename.aspx" rel="nofollow">Reimplementation of Select</a></p> <p><strong>UPDATE:</strong> I noticed in one of your comment to one of the other comments and it seems like it is the lambda and not linq itself that is confusing you. If you read Skeet's blog post you see that <code>Select</code> has two overloads:</p> <pre><code>public static IEnumerable&lt;TResult&gt; Select&lt;TSource, TResult&gt;( this IEnumerable&lt;TSource&gt; source, Func&lt;TSource, TResult&gt; selector) public static IEnumerable&lt;TResult&gt; Select&lt;TSource, TResult&gt;( this IEnumerable&lt;TSource&gt; source, Func&lt;TSource, int, TResult&gt; selector) </code></pre> <p>The <code>Select</code> with index matches the second overload. As you can see it is an extension of <code>IEnumerable&lt;TSource&gt;</code> which in your case is the list of <code>ints</code> and therefor you are calling the <code>Select</code> on an <code>IEnumerable&lt;int&gt;</code> and the signature of <code>Select</code> becomes: <code>Select&lt;int, TResult&gt;(this IEnumerable&lt;int&gt; source, Func&lt;int, int, TResult&gt; selector)</code>. As you can see I changed <code>TSource</code> against <code>int</code>, since that is the generic type of your <code>IEnumerable&lt;int&gt;</code>. I still have <code>TResult</code> since you are using anonymous type. So that might explain some parts?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload