什么是C#相当于LT的&;地图和GT;在C ++? [英] What is C# equivalent of <map> in C++?
本文介绍了什么是C#相当于LT的&;地图和GT;在C ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经定义的类myComplex。我把它映射为整数。在C ++中我就已经创建了一个地图为
地图< myComplex,INT>
第一;
I have defined a class myComplex. I need to map it to integers. In C++ I would have created a map as
map<myComplex,int>
first;
如何做这样的事情在C#?
How to do such thing in C#?
推荐答案
相当于将类的 SortedDictionary< TKEY的,TValue>
在 System.Collections.Generic
命名空间。
The equivalent would be class SortedDictionary<TKey, TValue>
in the System.Collections.Generic
namespace.
如果您不关心顺序类的 词典< TKEY的,TValue>
在 System.Collections.Generic
命名空间很可能就足够了。
If you don't care about the order the class Dictionary<TKey, TValue>
in the System.Collections.Generic
namespace would probably be sufficient.
这篇关于什么是C#相当于LT的&;地图和GT;在C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文