Skip to content

Instantly share code, notes, and snippets.

@AymericG
Created January 23, 2012 10:37
Show Gist options
  • Save AymericG/1662398 to your computer and use it in GitHub Desktop.
Save AymericG/1662398 to your computer and use it in GitHub Desktop.
public class Team
{
public List<Player> Players { get; set; }
public int TotalRuns
{
get
{
return Players.Sum(player => player.Runs);
}
}
public void Scorecard()
{
foreach (var player in Players)
{
GameLog.Add(player.Name + ": " + player.Runs + " runs");
}
}
public Team ()
{
Players = new List<Player>();
for (int i = 1; i < 12; i++)
{
var player = new Player
{
Name = "Player " + i,
Batting = 85 - (i*i)
};
Players.Add(player);
}
}
public void Play()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment