learning linq: quicksort


i took thrust afternoon began study linq, distant only mucking around linq collections. initial things i attempted exercise qsort.



now -- ignoring fact i could only an orderby unequivocally stupid qsort doing -- i came adult this:



public category lqsort
{
open stationary list<int> qslinq(list<int> _items)
{
(_items.count <= 1)
relapse _items;

int _pivot = _items[0];

list<int> _less = (from _item _items where _item < _pivot name _item).tolist();
list<int> _same = (from _item _items where _item == _pivot name _item).tolist();
list<int> _greater = (from _item _items where _item > _pivot name _item).tolist();

relapse (qslinq(_less).concat(_same.concat(qslinq(_greater)))).tolist();
}
}


the wholly thing unequivocally bugs me casting involved. there any linq tricks i competence use? am i only controlling linq things wasn't commanded for?



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members