Abh*_*ngh 46 c# c++ dictionary language-comparisons visual-c++
我已经定义了一个类myComplex.我需要将它映射到整数.在C++中,我会先创建一个地图
map<myComplex,int>
;
如何在C#中做这样的事情?
dal*_*lle 95
相当于将类SortedDictionary<TKey, TValue>
的System.Collections.Generic
命名空间.
如果你不关心命令Dictionary<TKey, TValue>
,那么System.Collections.Generic
命名空间中的类可能就足够了.
han*_*aad 40
std::map<Key, Value>
→ SortedDictionary<TKey, TValue>
std::unordered_map<Key, Value>
→ Dictionary<TKey, TValue>
看一下System :: Collections :: Generic 中的Dictionary类。
Dictionary<myComplex, int> myMap = new Dictionary<myComplex, int>();
Run Code Online (Sandbox Code Playgroud)