Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

The c# syntax, myNewList = (from i in myList where i > 3 && i != 7 select i * 4).toList(), is nice too. Similar to using LINQ, myList.Where(i => i > 3), but I don't believe that form allows an easy use of the i * 4 part. One annoyance I have with .NET is there are too many types that are similar-but-not-quite a List<>, making me do conversions often. At least it's usually not much more than a .ToList(), except in the case of the controls in a Windows Form, which are their own weird list-type structure that doesn't support that.


For older .Net collections you can use Cast<T>() to get LINQ goodness. Something like this would work:

  var values = from x in combobox.Items.Cast<ComboBoxItem>() where x.Value > 5 select x.Value;




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: