Live Demos

Monday, March 12, 2012

Refactoring with LINQ

So my little brother sent over the code below last week and asked me if there was a better way to do it. When I first read through it I was thinking…I can’t believe people still use the good ole to/from listbox style UI. I don’t remember the last time I had to write this code, but I’m pretty sure it was prior to LINQ.

So here’s what I came up with in my response using LINQ.

Basically I was able to get rid of all the for loops, sorting, adding items, and most importantly, the new version is more readable.

Shout it

1 comment:

  1. Hello friends, how is the whole thing, and what you desire to say about this paragraph, in my view its in fact remarkable designed for me.


    Review my web site; Free TV Series

    ReplyDelete