-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: saileshsaha
Message 3 in Discussion
Hi Ambrose,
You can use something like:
//arrayList is the actual arrayList from
which objects are to be removed.
// take another arraylist IndexList to store
the indexes of objects to be removed.
public void Delete( )
{
int index = 0;
// since each of the objects have val1 as
described by you, use it to identify objects to be deleted
foreach(Data data in arrayList)
{
if(data.val1 = =
yourValue)
{
IndexList.Add(index);
}
index++;
}
// now delete the objects at specified
indexes
foreach(int num in IndexList)
{
arrayList.RemoveAt(num);
}
}
Hope this helps.
Thanks and Regards,
Sailesh
-----Original Message-----
From: Ambrose
[mailto:[EMAIL PROTECTED]
Sent: Monday, November 03, 2003
6:59 PM
To: BDOTNET
Subject: About Remove in
arrayList
New Message on BDOTNET
About
Remove in arrayList
Reply
Reply to Sender Recommend
Message 1 in
Discussion
From: Ambrose
Hi
All,
I
have a ArrayList in which data are stored as Objects like
instance of class like below
arr.add(new Data(val1,val2val3));
I
want to remove elements from the arraylist. If I use the
removeat method its started giving Problem coz of length is
reduced on every removal. Although it is working for single
Selection Its not working for Multiple selection. I can't use
the removeRange also coz its not neccessary it has to be
continous. So I thought of using the REmove Method for that what
has to pass. I have a value val1 for each Object. I don't know
how to remove from the ArrayList.
Any
idea will be helpful for me
Thanks
Anandraj.A.
View other groups in this
category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]