static void Main(string[] args) { // Connect to client and get data var client = new NFLv3StatsClient("api_key_goes_here"); var players = client.GetPlayers(); // Write data to console foreach (var player in players) { Console.WriteLine($"{player.PlayerID} - {player.Name} - {player.Team}"); } Console.WriteLine(); Console.WriteLine("Press enter to continue..."); Console.ReadLine(); }
// function to get the playerID public void GetPlayerInfo(GeneralPlayer f, NFLv3StatsClient client) { // utilizes the SDK's class to pull data. could not come up with another way Predicate <Player> playerFinder = (Player p) => { return(p.Name == f.name); }; var tmpPlayer = client.GetPlayers().Find(playerFinder); if (tmpPlayer != null) { f.playerID = tmpPlayer.PlayerID; f.team = tmpPlayer.Team; f.position = tmpPlayer.Position; f.number = (int)tmpPlayer.Number; if (tmpPlayer.ByeWeek != null) { f.byeWeek = (int)tmpPlayer.ByeWeek; } } else { Console.WriteLine("Error!"); } }