Hacker News new | ask | show | jobs
by WorkerBee 5877 days ago
that's the same as

var foo= new List<int> {1, 2, 3};

var bar = foo.Select(x => x*2);

1 comments

Yep, one thing to realize is that LINQ does not simply refer to the query syntax - it refers to a set of technologies, including expression trees and the ability to compile them to alternate languages like TSQL, the query syntax, and the extension methods like Select.

One small difference with your example though is that Select requires "using System.Linq", and ConvertAll is defined on List<T>.

And of course, the LINQ version returns an IEnumerable<TResult>, while the List version return List<TResult>. You could chain a .ToList() there to make them equivalent (if needed).