تسجيل الدخول

مشاهدة النسخة كاملة : Proper way to sort a List Custom objects



C# Programming
08-31-2009, 01:38 AM
I have been thinking about this for a while and want to be correct in how I go about this.

I have a custom struct.

struct MYSTRUCT
{
public double address;
public short datLen;
public string data;
}

I am using an array for these, and chose the List because of the Add method.

What I want to do is resort the list based on the Address highest to lowest.

I am pretty unfamiliar with the IComparer and Comparison option in the built in ListSort.

Will one of those work for me? Do I override the Sort method? Do I just create a new method to sort the list?

How would you guys go about this?

Thanks in advance.

*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW