Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I have an ArrayList of structures and I want to sort the array on different members of the structure so that I can give a rank each element of the array.

 

So I thought I would sort it for each member in turn add add a rank member to the structure for each member i want to sort

 

Confusing I bet.

 

How else would you do this? I want to step through a database fill an array then sort by differen members and then rank each member in the array so that I can create a table with the member values and there rank next to it

 

Thanks for any help given

Malcolm

Posted
I would create an IComparer that can perform any/all required sorts, or you could create a class for each type of sorts. The ArrayList.Sort method is overloaded and one or more methods take an IComparer as an argument.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...