Things which annoy me in .Net #372
Oct. 8th, 2010 05:18 pmThere were no generics in the first version. And all of the Windows Forms code was written then, and hasn't been updated to use generics.
So (for instance), despite all of the items in Listview.Items being of type ListviewItem they're returned as Object, because it implements IEnumerable, rather than IEnumerable.
So if I want to get a list of items from the listview I have to iterate around them all, casting them to the correct type rather than just using an AddRange. Admittedly, on an individual level this isn't much of a hardship, but it's still frustrating when you add up all of the times I have to do something like that.
I know that going back and updating all of the Windows Forms code to be generic compliant would be extra effort, but it seems like one of those things that would be worth it...
So (for instance), despite all of the items in Listview.Items being of type ListviewItem they're returned as Object, because it implements IEnumerable, rather than IEnumerable
So if I want to get a list of items from the listview I have to iterate around them all, casting them to the correct type rather than just using an AddRange. Admittedly, on an individual level this isn't much of a hardship, but it's still frustrating when you add up all of the times I have to do something like that.
I know that going back and updating all of the Windows Forms code to be generic compliant would be extra effort, but it seems like one of those things that would be worth it...
no subject
Date: 2010-10-08 06:19 pm (UTC)*though a tiny little bit slower, of course
no subject
Date: 2010-10-08 06:22 pm (UTC)http://en.wikipedia.org/wiki/ADO.NET_Entity_Framework
And yeah, I end up wrapping stuff to make it at least _look_ strongly typed. I don't care that much about speed - nothing I do is going to take more than milliseconds, the slow bit is always fetching data from the back end business logic systems.