using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
public static void Main()
int maxCountFromMapTable = 10;
int boxScoreTotalCount = 0;
List<BoxScores> boxScores = new List<BoxScores>();
boxScores.Add(new BoxScores { GameID = "1", Points = 1 });
boxScores.Add(new BoxScores { GameID = "2", Points = 2 });
boxScores.Add(new BoxScores { GameID = "3", Points = 3 });
boxScores.Add(new BoxScores { GameID = "4", Points = 4 });
boxScores.Add(new BoxScores { GameID = "5", Points = 5 });
var filteredBoxScores = boxScores.SkipWhile(b => (boxScoreTotalCount += Convert.ToInt32(b["PTS"])) <= maxCountFromMapTable);
string[] gameIDs = filteredBoxScores.Select(f => f.GameID).ToArray();
int startRunningCount = maxCountFromMapTable;
foreach (var boxScore in filteredBoxScores)
Console.WriteLine("filterBoxScores.Count: " + filteredBoxScores.Count() + ", StartRunningCount:" + startRunningCount);
startRunningCount += Convert.ToInt32(boxScore["PTS"]);
public string GameID { get; set; }
public int PersonID { get; set; }
public int TeamID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public short Minutes { get; set; }
public int? FieldGoals { get; set; }
[Column("Field_Goals_Attempted")]
public int? FieldGoalsAttempted { get; set; }
[Display(Name = "FG_PCT")]
[Column("Field_Goal_Percentage")]
public decimal? FieldGoalPercentage { get; set; }
[Column("Three_Pointers")]
public int? ThreePointers { get; set; }
[Column("Three_Pointers_Attempted")]
public int? ThreePointersAttempted { get; set; }
[Column("Three_Point_Percentage")]
public decimal? ThreePointPercentage { get; set; }
public int? FreeThrows { get; set; }
[Column("Free_Throws_Attempted")]
public int? FreeThrowsAttempted { get; set; }
[Display(Name = "FT_PCT")]
[Column("Free_Throw_Percentage")]
public decimal? FreeThrowPercentage { get; set; }
[Column("Offensive_Rebounds")]
public int? OffensiveRebounds { get; set; }
[Column("Defensive_Rebounds")]
public int? DefensiveRebounds { get; set; }
public int? Assists { get; set; }
[Column("Personal_Fouls")]
public int? PersonalFouls { get; set; }
public int? Steals { get; set; }
public int? Turnovers { get; set; }
[Column("Blocked_Shots")]
public int? BlockedShots { get; set; }
public int? Points { get; set; }
public DateTime? DateEst { get; set; }
public string Location { get; set; }
public string Grouping { get; set; }
public string Outcome { get; set; }
public string SeasonID { get; set; }
public int VsTeamID { get; set; }
public string LeagueID { get; set; }
[Column("Technical_Fouls")]
public int? TechnicalFouls { get; set; }
[Column("Flagrant_Fouls")]
public int? Flagrant_Fouls { get; set; }
public int? Ejections { get; set; }
[Column("Points_In_Paint")]
public int? Points_In_Paint { get; set; }
[Column("Fast_Break_Points")]
public int? Fast_Break_Points { get; set; }
[Column("Triple_Doubles")]
public int? Triple_Doubles { get; set; }
[Column("Double_Doubles")]
public int? Double_Doubles { get; set; }
[Column("actual_minutes")]
public int? actual_minutes { get; set; }
[Column("actual_seconds")]
public int? actual_seconds { get; set; }
public int? Plus_Minus { get; set; }
[Column("Blocks_Against")]
public int? Blocks_Against { get; set; }
public short? PTS_OFF_TO { get; set; }
[Column("Second_Chance_PTS")]
public short? Second_Chance_PTS { get; set; }
[Column("Total_Rebounds")]
public int? Total_Rebounds { get; set; }
public object this[string displayName]
var propertiesWithDisplayAttribute = GetType().GetProperties().Where(x => x.GetCustomAttributes(typeof(DisplayAttribute), true).Any());
foreach (var property in propertiesWithDisplayAttribute)
var att = property.GetCustomAttributes(typeof(DisplayAttribute), true).FirstOrDefault() as DisplayAttribute;
if (att.Name == displayName)
return property.GetValue(this, null);