473,387 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

dumb remove question

Well here's a sample of the code:

class someobject{};
ArrayList alist;

alist = new ArrayList();

for(int i = 0; i<10;++i)
alist.Add(new someobject());


OK now how do I get rid of the 10 objects in alist?

Does Remove remove the object and delete it. Or does it just remeove it from
the list?

If it doesn't, how do I delete the objects?
Thanks,
Bill
Oct 4 '07 #1
2 1000
..Remove removes the object from the list.
You don't need to delete the object, as long as you don't have any other
references to that object the GC will get around to deleting it at some
point.

http://msdn.microsoft.com/msdnmag/issues/1100/gci/ is an intro to .Net and
the GC
"news" <wj****@hotmail.comwrote in message
news:qa******************************@comcast.com. ..
Well here's a sample of the code:

class someobject{};
ArrayList alist;

alist = new ArrayList();

for(int i = 0; i<10;++i)
alist.Add(new someobject());


OK now how do I get rid of the 10 objects in alist?

Does Remove remove the object and delete it. Or does it just remeove it
from the list?

If it doesn't, how do I delete the objects?
Thanks,
Bill
Oct 4 '07 #2
On Oct 4, 11:43 am, "news" <wjf...@hotmail.comwrote:
Well here's a sample of the code:

class someobject{};
ArrayList alist;

alist = new ArrayList();

for(int i = 0; i<10;++i)
alist.Add(new someobject());

OK now how do I get rid of the 10 objects in alist?
alist.Clear();
Does Remove remove the object and delete it. Or does it just remeove it from
the list?
Just remove it from the list. Note that the object itself isn't in the
list - just a reference to the object.
If it doesn't, how do I delete the objects?
Why do you want to delete the objects in the first place? That's what
the garbage collector is for.

Jon

Oct 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: squash | last post by:
a dumb question i had on my mind: Say you have a dynamically created web page . Isn't it more secure to write it in php since a visitor will not be able to tell it is dynamically created? But...
15
by: Good Man | last post by:
Hey there I have a dumb question.... Let's say i have a database full of 4000 people.... I select everything from the database by: $result = mysql_query("SELECT * FROM People");
2
by: InvisibleMan | last post by:
Hi, I feel a little dumb for asking this (considering im writing TSQL) but there doesn't seem to be any definitive answers on the search engines... Okay I understand that if you open the ADO...
2
by: Tibby | last post by:
I have 2 textboxes and a button on my .aspx form. When I press tab on the first box, it goes to the addressbar, then to the second box after another tab. I thought that maybe if I set the tab...
15
by: Bob | last post by:
I'm about to convert to string and use regex, but I thought there must be something I'm missing here that already exists. Bob
2
by: Bill Nguyen | last post by:
I would like to add a new VB.NET project using the same folder being used by another project so that I can share several forms already creaded by the other project. However, .NET created a new...
3
by: Carlos Albert | last post by:
Hello, I never worked using repeaters. There is no way to work with it in design view? I've no problem working with the source code, but I don't know how the databinds works using just HTML... ...
6
by: Robert Dufour | last post by:
What is the meaning of the word marshal and unmarshal in plain english as applied to an exe file? Does it mean the application has started and ended? Thanks for any help, Happy new year, Bob
10
by: Dick Moores | last post by:
I'm still trying to understand classes. I've made some progress, I think, but I don't understand how to use this one. How do I call it, or any of its functions? It's from the Cookbook, at...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.