JJ,
It works pretty much like an array of objects except that the number of
elements is dynamic rather than fixed. To update:
arrayList[rowNumber] = newThing;
To extract an item:
object oldThing = arrayList[rowNumber];
I'm leaving out casting; if the items in the arraylist are of a particular
type, say MyType:
MyType oldThing = (MyType)arrayList[rowNumber];
You should Google and read one of the basic tutorials and/or check out the
help for ArrayList -- particularly the Add(), AddRange(), IndexOf(),
Remove() and RemoveAt() methods, the Count property and of course the Item
property (indexer in C#) which I've focused on above.
--Bob
"JJ" <JJ@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
ok so how would I update a record in an arrowlist? So how would I be able
to
check or get individual items of arraylist?
Thanks,
JJ
"Jon Skeet [C# MVP]" wrote:
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 - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too