Take and SelectMany in CSharp
Description
The following code shows how to take and SelectMany.
Example
using System;//ww w . j a va 2s . c om
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
public static void Main() {
string[] presidents = {"Aaa", "Art", "Buch", "Bushman", "Carter", "land"};
IEnumerable<char> chars = presidents.Take(5).SelectMany(s => s.ToArray());
foreach (char ch in chars)
Console.WriteLine(ch);
}
}
The code above generates the following result.