![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Get the last item in ArrayList 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! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Get the last item in ArrayList 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 Quote: >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! |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Get the last item in ArrayList 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. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Get the last item in ArrayList On Fri, 24 Oct 2008 14:39:50 -0700 (PDT), Curious <fir5tsight@xxxxxx> wrote: Quote: >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. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Get the last item in ArrayList 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 Quote: > 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. |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Get the last item in ArrayList Quote: > 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. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| rename-item, move-item and special chars. | PowerShell | |||
| Empty Arraylist is null? | PowerShell | |||
| Copy-Item : Container cannot be copied onto existing leaf item. | PowerShell | |||
| Marshalling ArrayList | .NET General | |||
| Thread-safety: Change property of items in arraylist versus removingitems from the arraylist | .NET General | |||