❔ Foreach loop
I am trying to run through my list, but nothing is being printed out, what am I doing wrong?
8 Replies
Does enrollment class has a ToString() method?
No
I am not sure why it isn't printing anything, because it should have values inside the list right?
did you add elements to the list?
If you want to print the name and the enrollment class you should have a ToString() method on the class and format there your message
you didn't add anything to the list
you just made the Enrollments without adding them
Oooh... A website suggests that I do this, but is this really what I am looking for?
Should I use .Add?
.Add does add things to the list, yes
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.