What is gcnew?

.net, c++-cli

Solution

gcnew is for .NET reference objects; objects created with gcnew are automatically garbage-collected; it is important to use gcnew with CLR types

Problem

I stumbled across this code and am too proud to go and ask the author what it means. ``` Hashtable^ tempHash = gcnew Hashtable(iterators_); IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator(); ``` What is `gcnew` and how important is it to use that instead of simply `new`? (I'm also stumped by the caret; I asked about that over here.)

Original source

Related problems