Quick question about gcnew

Hi,

I'm writing a windows form application in which a have a
listBox Object. In first it's empty. To add items I just say:

 
myForm->myListBox->Items->Add(gcnew Object());


more specifically:

1
2
Object^ myObj = gcnew Object();
myForm->myListBox->Items->Add(myObj);


Now the question, propably a noob's one:
Do I have to worry about the "gcnew" Objects I create just
like the "new" Objects and delete them when the program closes?
Last edited on
Do I have to worry about the "gcnew" Objects
That's the point of gcnew: No you must not delete it. gc in gcnew stands for garbage collector and that does the delete for you
Perfect!

This is available only C++/CLI or I can use it and with C++?
You cannot use it in C++.
thank you for your time
Topic archived. No new replies allowed.