views:

40

answers:

1

hi, I'm using listbox in c# as a container to a user-defined objects. how can I sort the list by a class member (int) of the objects?

+3  A: 
list = list.OrderBy(item => item.NumberValue).ToList();

[Edit]

This is given that the list you hade is named list, you've included the System.Linq namespace, and that the numeric property you were talking about is named NumberValue.

Alxandr