积极答复者
VS2012RC的命名空间是using namespace Platform;我想用System空间里的怎么办?

问题
-
VS2012RC的命名空间是using namespace Platform;我想用System空间里的怎么办?
我现在想在Metro风格的C++中使用list类,我看了MSDN是如下定义的:
using namespace System;
using namespace System::Collections::Generic;
void main()
{
List<String^>^ dinosaurs = gcnew List<String^>();
Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity);
dinosaurs->Add("Tyrannosaurus");.......................省略
}
但是我要是输入using namespace System;则会报错,那我如何使用list呢,请高手帮帮忙,谢谢了。
答案
-
Metro C++ 中对.Net List<T>的是 Platform::Collections::Vector<T> 添加不是 Add 而是 Append
其他还有 IIterable<T> 对应 .Net 的 IEnumerable<T>,IMap<T> 对应 IDictionary<T>
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
- 已标记为答案 Jie BaoModerator 2012年6月22日 3:04
-
是应该这样定义, list->GetAt(i) (用括号,而不是中括号) 返回 index = i 的那个Object
相当于.Net 的 list[i]
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
- 已编辑 Jie BaoModerator 2012年6月6日 7:43
- 已标记为答案 JJ李锋 2012年6月6日 9:35
全部回复
-
Metro C++ 中对.Net List<T>的是 Platform::Collections::Vector<T> 添加不是 Add 而是 Append
其他还有 IIterable<T> 对应 .Net 的 IEnumerable<T>,IMap<T> 对应 IDictionary<T>
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
- 已标记为答案 Jie BaoModerator 2012年6月22日 3:04
-
是应该这样定义, list->GetAt(i) (用括号,而不是中括号) 返回 index = i 的那个Object
相当于.Net 的 list[i]
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
- 已编辑 Jie BaoModerator 2012年6月6日 7:43
- 已标记为答案 JJ李锋 2012年6月6日 9:35