Link to home
Start Free TrialLog in
Avatar of N P
N P

asked on

c# how do I Sort a list

I have a class that has 2 fields.  After I populate the fields, how can I sort them.  The fields will be bound to data source.

Here is my class that has fields:

        public class FieldToGridSummary 
        {
            public string GSSummary { get; set; }
            public string GSOrder { get; set; }
        }

Open in new window


and here is how I use it

static BindingList<FieldToGridSummary> [b]FieldToGridSummaryList[/b] = new BindingList<FieldToGridSummary>();
FieldToGridSummary gsm; 

gsm = new FieldToGridSummary();

for each loop
{
     gsm.GSOrder = lastname
     gsm.GSSummary = summary
     FieldToGridSummaryList.Add(gsm);
}

xamDataGrid1.DataSource = FieldToGridSummaryList;

Open in new window


how can I sort  FieldToGridSummaryList by GSOrder?

thanks
Nick
ASKER CERTIFIED SOLUTION
Avatar of rpkhare
rpkhare
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial