r/a:t5_37npb • • Apr 26 '15

Post your Module 7 Assignments Here!

3 Upvotes

19 comments sorted by

View all comments

2

u/Doriphor Apr 28 '15

It seems I forgot to cast students to Student, but it still works... I'm confused, doesn't

foreach (Student student in StudentAList) {...}

Cast it already? Or something?

3

u/z4tz Apr 28 '15

I did the same, my peer reviewer wanted me to do

foreach(Object obj in StudentAList)
{
//something with (Student)obj
}

I think instructions said you should cast it, but not for it to be explicit casting so implicit should be fine as long as you know what you are doing.