Thread-safe dictionary implementation. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.
#include<system/collections/concurrent/concurrent_dictionary.h>#include<system/smart_ptr.h>usingnamespaceSystem;usingnamespaceSystem::Collections::Generic;intmain(){constintitemsCount=32;// Create the ConcurrentDictionary-class instance.
autoconcurrentDictionary=MakeObject<ConcurrentDictionary<int,int>>();// Fill the concurrent dictionary.
for(autoi=0;i<itemsCount;++i){concurrentDictionary->Add(i,i*i);}Console::WriteLine(concurrentDictionary->idx_get(3));return0;}/*
This code example produces the following output:
9
*/