Rich

Rich

  • NA
  • 84
  • 61.2k

Returning Complete Sequence

Jan 17 2012 1:32 PM
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)