What is gcnew?

PHOTO EMBED

Tue Jun 28 2022 14:24:40 GMT+0000 (Coordinated Universal Time)

Saved by @Marcos_ #cpp

Hashtable^ tempHash = gcnew Hashtable(iterators_);

IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator();
content_copyCOPY

gcnew is for .NET reference objects; objects created with gcnew are automatically garbage-collected; it is important to use gcnew with CLR types just like the new operator, except you don't need to delete anything created with it; it's garbage collected. You use gcnew for creating .Net managed types, and new for creating unmanaged types.

https://stackoverflow.com/questions/202459/what-is-gcnew