2011-10-20 56 views
0

我想C++等價於下面的C#。C++ IEnumerable <int> = class-> method();在WinForms中

List<int> k = myclass.method().ToList(); 

在我的C++標準的WinForms應用程序,我已經試過如下:

IEnumerable<int>^ m= myclass->method(); 

我收到以下錯誤:

C2872 IEnumerable ambiguous symbol

請幫助我瞭解和解決我的問題。

回答

2

有兩個IEnumerable s - 一個在System::Collections中,一個在System::Collections::Generic

不管怎樣,你必須在範圍(可能用指令),所以你需要或者刪除使用指令或完全限定的類型名稱說:

System::Collections::Generic::IEnumerable<int>^ m = myclass->method(); 
+0

現在一切工作正常 – John

相關問題