Re: reverse a collection
From: Jay B. Harlow [MVP - Outlook] (Jay_Harlow_MVP_at_msn.com)
Date: 11/26/04
- Next message: Hypnotron: "Re: My EXE file increased in FileSize... A LOT!"
- Previous message: Jay B. Harlow [MVP - Outlook]: "Re: This Group, what more do we need ?"
- In reply to: nafri: "reverse a collection"
- Next in thread: chanmmn: "Re: reverse a collection"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 26 Nov 2004 08:34:59 -0600
Nafri,
It depends on what kind of collection you have, ArrayList has a ToArray
method, if your collection is based on ArrayList either directly or
indirectly (CollectionBase) you can leverage this method.
ArrayList has AddRange & a constructor that accepts a collection, you could
indirectly (CollectionBase) leverage this methods to return the array back
to the collection.
If your collection is not based directly or indirectly on ArrayList, or have
similar methods, then you are correct, looping may be your only option.
Some collections, such as Hashtable, do not support he concept of an order,
so reversing them do not make sense per se.
Hope this helps
Jay
"nafri" <spamMe@spam.net> wrote in message
news:F3D5DA8B-4CAB-425C-A9AD-E747E35531FB@microsoft.com...
>i have a colleciton that i need to reverse. Array has a reverse method. Is
> their any direct way to transfer the items in the collection to an array
> or
> arraylist, reverse the array and transfer back them to the collection.
> Or looping through each element is the only option.
>
> TIA
> nafri
- Next message: Hypnotron: "Re: My EXE file increased in FileSize... A LOT!"
- Previous message: Jay B. Harlow [MVP - Outlook]: "Re: This Group, what more do we need ?"
- In reply to: nafri: "reverse a collection"
- Next in thread: chanmmn: "Re: reverse a collection"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|