4
Answers

Returning Complete Sequence

Rich

Rich

12y
1.2k
1
Below within my method I have the statement nba_Team_Names nbaTeam = item.nba_Team_Names.FirstOrDefault();

This seems to return the first element or string in the sequence, but how do I return the entire sequence?

 public void GetTeams()
        {
            IQueryable<Sports_Leagues_Level> team = from t in db.Sports_Leagues_Level
                                                    .Include("nba_Team_Names")
                                                    select t;
            foreach (Sports_Leagues_Level item in team)
            {
                Console.WriteLine(item.ID);
                nba_Team_Names nbaTeam = item.nba_Team_Names.FirstOrDefault();
                if (nbaTeam != null)
                {
                    Console.WriteLine(nbaTeam.Full_Name);
                }
                else
                {
                    Console.WriteLine("No Nba Team");
                }
            }
        }

Answers (4)