Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDominik Huber
4,631 PointsHow is this working? She never adds the GameResult to the List<GameResult>?
In the method there is a while loop. And in the while loop there is this code:
GameResult gameResult = new GameResult();
Doesn't that mean that every new iteration the gameResult value gets overrided every new iteration? She never adds the finished object to the list, does she?
Maybe if someone can explain me what is going on there.
Thank you!
1 Answer
Steven Parker
231,269 PointsThe gameResult object is added to the list. After populating it with data, the last statement in the loop is:
soccerResults.Add(gameResult);
This is the last change made to the code in that video.
Dominik Huber
4,631 PointsDominik Huber
4,631 PointsThx that explains it. Thank you!