62
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
List<PlayerPerformance> playerPerformances = new List<PlayerPerformance>
10
{
11
new PlayerPerformance { PlayerID = 1, PlayerName = "John Doe", Team = "A", GameDate = new DateTime(2023, 3, 10), PointsScored = 22, Rebounds = 5, Assists = 7 },
12
new PlayerPerformance { PlayerID = 2, PlayerName = "Jane Smith", Team = "B", GameDate = new DateTime(2023, 3, 10), PointsScored = 15, Rebounds = 4, Assists = 10 },
13
new PlayerPerformance { PlayerID = 3, PlayerName = "Emily Jones", Team = "A", GameDate = new DateTime(2023, 3, 11), PointsScored = 30, Rebounds = 7, Assists = 5 },
14
new PlayerPerformance { PlayerID = 4, PlayerName = "Michael Brown", Team = "B", GameDate = new DateTime(2023, 3, 11), PointsScored = 18, Rebounds = 8, Assists = 11 },
15
// Add more player performance entries as needed
16
};
17
18
// Step 1: Calculate the total points scored, total rebounds, and total assists for each team
19
var teamStats = playerPerformances
20
.GroupBy(p => p.Team)
21
.Select(g => new
22
{
23
Team = g.Key,
24
TotalPointsScored = g.Sum(p => p.PointsScored),
Cached Result
\file03\Wholesale_Solutions\Statements\Checked\Archive\2015