Create a gist now

Instantly share code, notes, and snippets.

@sklivvz /cultures
Last active Aug 29, 2015

What would you like to do?
void Main()
{
CultureInfo
.GetCultures(CultureTypes.AllCultures)
.Select(x =>
new string[]{x.IetfLanguageTag, x.EnglishName, x.NativeName,x.LCID.ToString()}
.Concat(z=>"<td>"+z+"</td>")
)
.Select(x => "<tr>"+x+"</tr>")
.Each(Console.WriteLine);
}
static class Extensions
{
public static void Each<T>(this IEnumerable<T> list, Action<T> action)
{
foreach(var v in list) action(v);
}
public static string Concat(this IEnumerable<string> list, Func<string, string> func)
{
var b = new StringBuilder();
list.Each(x=>b.Append(func(x)));
return b.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment