• Post Reply Bookmark Topic Watch Topic
  • New Topic

cast List of SelectItem to Array of SelectItem

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get this error:



when casting a List<SelectItem> to SelectItem[]:




Does anyone know whats wrong?
 
Tim Holloway
Bartender
Posts: 18413
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's creating for the worst-case, but I'd have to RTFM.

I prefer this.



You may need to double-check the documentation, but the idea is that if I pre-allocate an array of the right type, I get the benefit that it will be a homogeneous array and I won't have to cast. I'm allergic to casting, even with run-time type checking.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay thanks, I wil try it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!