I have an ArrayList outputList. I only need to get the last item:
int last = outputList.LastIndexOf(null);
ExtremeBucket lastItem =
(ExtremeBucket)outputList[last];
Please confirm if this is the right way. Thanks!
I have an ArrayList outputList. I only need to get the last item:
int last = outputList.LastIndexOf(null);
ExtremeBucket lastItem =
(ExtremeBucket)outputList[last];
Please confirm if this is the right way. Thanks!
No, to get the last item in the list, use
int last = outputList [outputList.Count () - 1];
I have no idea how you are converting an int to an ExtremeBucket though.
"Curious" <fir5tsight@xxxxxx> wrote in message
news:2cccbb3d-cbdd-49e6-8b76-992404df2fa0@xxxxxx
>I have an ArrayList outputList. I only need to get the last item:
>
> int last = outputList.LastIndexOf(null);
> ExtremeBucket lastItem =
> (ExtremeBucket)outputList[last];
>
> Please confirm if this is the right way. Thanks!
Family Tree Mike:
Thanks! FYI, I used the following approach you've suggested:
ExtremeBucket lastItem =
(ExtremeBucket)outputList[outputList.Count - 1];
Each item is type of ExtremeBucket.
On Fri, 24 Oct 2008 14:39:50 -0700 (PDT), Curious
<fir5tsight@xxxxxx> wrote:
You should consider using the generic List instead of ArrayList. That
>Family Tree Mike:
>
>Thanks! FYI, I used the following approach you've suggested:
>
> ExtremeBucket lastItem =
>(ExtremeBucket)outputList[outputList.Count - 1];
>
>Each item is type of ExtremeBucket.
way your access to the list will be type safe.
I agree with Jack, that List<ExtremeBucket> will be better for you in the
long run.
"Curious" <fir5tsight@xxxxxx> wrote in message
news:691b4373-6e3e-445a-a9e0-8083992fcd40@xxxxxx
> Family Tree Mike:
>
> Thanks! FYI, I used the following approach you've suggested:
>
> ExtremeBucket lastItem =
> (ExtremeBucket)outputList[outputList.Count - 1];
>
> Each item is type of ExtremeBucket.
I do intend to use List<ExtremeBucket>. However, since this must be
> I agree with Jack, that List<ExtremeBucket> will be better for you in the
> long run.
coded in Visual Studio 2003 (which is compatible with .NET 1.1), I
have to use ArrayList because it doesn't recognize generic.
| Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| rename-item, move-item and special chars. | sardinian_guy | PowerShell | 3 | 26 Jul 2009 |
| Empty Arraylist is null? | Lars Zeb | PowerShell | 3 | 01 Apr 2009 |
| Copy-Item : Container cannot be copied onto existing leaf item. | Steve | PowerShell | 3 | 17 Mar 2009 |
| Marshalling ArrayList | Saad | .NET General | 0 | 26 Sep 2008 |
| Thread-safety: Change property of items in arraylist versus removingitems from the arraylist | Curious | .NET General | 2 | 06 Aug 2008 |