What is gcnew?

后端 未结 3 1564
情书的邮戳
情书的邮戳 2020-12-08 13:18

I stumbled across this code and am too proud to go and ask the author what it means.

Hashtable^ tempHash = gcnew Hashtable(iterators_);

IDictionaryEnumerato         


        
3条回答
  •  被撕碎了的回忆
    2020-12-08 13:31

    gcnew is an operator, 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.

提交回复
热议问题