10
Answers

IQueryable question

Rich

Rich

12y
1.9k
1
In regards to my code block below.  Would the use of IQueryable<Sports_Leagues_Level> be better than the var keyword, and if so how would I implement it.

public void GetTeams()
        {
            var Teams = from sll in db.Sports_Leagues_Level
                        join nba in db.nba_Team_Names on sll.ID equals nba.SLLid
                        join league in db.Sports_Leagues on sll.Leagues equals league.Id
                        select new
                        {
                            SllId = sll.ID,
                            Team = nba.Abreviated_Long,
                            League = league.LeaguesAbr
                        };
            foreach (var item in Teams)
            {
                Console.WriteLine("{0} {1} {2}", item.SllId, item.League, item.Team);
            }
        }

Answers (10)