Skip to content

Instantly share code, notes, and snippets.

@Cauterite
Created April 14, 2017 04:54
Show Gist options
  • Save Cauterite/ed9ce498bc538fa15d4f805664bbc7f9 to your computer and use it in GitHub Desktop.
Save Cauterite/ed9ce498bc538fa15d4f805664bbc7f9 to your computer and use it in GitHub Desktop.
using System.Linq;
class Foo {
static void Main(string[] _) {
var xs = new[] {"apple", "passionfruit", "banana", "mango", "pear",};
/* https://msdn.microsoft.com/en-us/library/9eekhta0 */
var ys = xs
.Take(4)
.Select(x => x.ToUpper()) /* map */
.Where(x => x.Length < 6) /* filter */
.SelectMany(x => x) /* joiner */
.Take(9);
System.Diagnostics.Trace.Assert(
ys.SequenceEqual("APPLEMANG"));
System.Console.WriteLine(ys.ToArray());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment