Skip to content

Instantly share code, notes, and snippets.

@orangutanboy orangutanboy/1.cs
Last active Dec 19, 2015

Embed
What would you like to do?
foreach (var s in Enumerable.Range(1, 11).Zip("Davis, Clyne, Fonte, Hooiveld, Shaw, Davis, Schneiderlin, Cork, Lallana, Rodriguez, Lambert".Split(new[] { ", " }, StringSplitOptions.None), (num, name) => num + ". " + name))
{
Console.WriteLine(s);
}
foreach (var playerNameAge in "Jason Puncheon, 26/06/1986; Jos Hooiveld, 22/04/1983; Kelvin Davis, 29/09/1976; Luke Shaw, 12/07/1995; Gaston Ramirez, 02/12/1990; Adam Lallana, 10/05/1988"
.Split(new[] { "; " }, StringSplitOptions.None)
.Select(s => { var splits = s.Split(new[] { ", " }, StringSplitOptions.None); var d = DateTime.Parse(splits[1]); return new { Name = splits[0], DoB = d }; })
.OrderByDescending(p => p.DoB)
.Select(p => { var today = DateTime.Today; int age = today.Year - p.DoB.Year; if (p.DoB > today.AddYears(-age)) age--; return p.Name + " (" + age + ")"; }))
{
Console.WriteLine(playerNameAge);
}
Console.WriteLine(TimeSpan.FromSeconds("4:12,2:43,3:51,4:29,3:24,3:14,4:46,3:25,4:52,3:27"
.Split(',')
.Select(t => new { minutes = int.Parse(t[0].ToString()), seconds = int.Parse(t.Substring(2)) })
.Sum(t => t.minutes * 60 + t.seconds)));
foreach (var s in (from x in Enumerable.Range(0, 3)
from y in Enumerable.Range(0, 3)
select x + "," + y))
{
Console.WriteLine(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.