add changes to support generic lists as well as arrays.

Might not handle other IEnumerable<T> types which don't derive from List<T> though. 

Hi chillitom, I finally figured out github, please have a look at my patch, if you like it accept! please build it locally as I had to copy diffs across manually in the browser to get around my organisations firewall, so there may be a dumb compile error or something.

refer: http://stackoverflow.com/a/4959343/115734

cheers!