I used to use almost all the time the implicit type but since someone told me that using the keyword var
was a bad practice I'm now trying to use the explicit one. For this I tend to use the shortcut Ctrl+.
to change any implicit type to its explicit one.
Nevertheless, today I had to deal with two lists in one single Foreach. For this I used .Zip()
method. I tried changing its implicit type to the explicit one, but I can't. I also try to use the shortcut I mentioned but for some reason there wasn't the option.
var test = enemyTeam.Zip(imageList, (c, i) => new { Champion = c, Image = i });
Test1 (implicit type to Int type):
Test2 (implicit type to explicit type): I can't.
I also tried this implicit type but didn't work:
IEnumerable<new { CurrentGameParticipant Champion, PictureBox Image }> test = enemyTeam.Zip(imageList, (c, i) => new { Champion = c, Image = i });