Re: Accessing Arraylist Collection
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 03/02/05
- Next message: ad: "Re: How to share a .cs"
- Previous message: James: "Re: ModeLess Window in Word Addin: How to in C#"
- In reply to: JJ: "Accessing Arraylist Collection"
- Next in thread: JJ: "Re: Accessing Arraylist Collection"
- Reply: JJ: "Re: Accessing Arraylist Collection"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 2 Mar 2005 21:44:44 -0000
JJ <JJ@discussions.microsoft.com> wrote:
> I have created an Arraylist object from an Arraylist class.
> I added rows to the arraylist object and I need to find a particular record
> in my arraylist. How do I do this?
Do you mean by row number, or by row object? If it's by row object, use
IndexOf. If it's by row number, use the indexer:
object o = arrayList[rowNumber];
> Also if I was in the middle of building the arraylist and wanted to
> call the last record added to arraylist object how can I do this?
Use the indexer again, along with the Count property:
object last = arrayList[arrayList.Count-1];
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: ad: "Re: How to share a .cs"
- Previous message: James: "Re: ModeLess Window in Word Addin: How to in C#"
- In reply to: JJ: "Accessing Arraylist Collection"
- Next in thread: JJ: "Re: Accessing Arraylist Collection"
- Reply: JJ: "Re: Accessing Arraylist Collection"
- Messages sorted by: [ date ] [ thread ]