C++ IEnumerable=class->method();在WinForms中
我想要与以下 C# 等效的 C++。
List<int> k = myclass.method().ToList();
在我的标准 C++ WinForms 应用程序中,我尝试了以下操作:
IEnumerable<int>^ m= myclass->method();
我收到以下错误:
C2872 IEnumerable 不明确符号
请帮助我理解并解决我的问题。
I want the C++ equivalent to the following C#.
List<int> k = myclass.method().ToList();
In my standard C++ WinForms application I have tried the following:
IEnumerable<int>^ m= myclass->method();
I get the following error:
C2872 IEnumerable ambiguous symbol
Please help me understand and resolve my issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两个
IEnumerable
,一个在System::Collections
中,一个在System::Collections::Generic
中。不知何故,两者都在范围内(可能使用 using 指令),因此您需要删除所述 using 指令或完全限定类型名称:
There are two
IEnumerable
s -- one inSystem::Collections
, and one inSystem::Collections::Generic
.Somehow you have both in scope (probably with using directives), so you'll need to either remove said using directives or fully qualify the type name: