【发布时间】:2011-01-12 17:20:29
【问题描述】:
C++/CLI 的 System 命名空间中似乎不支持 Action 和 Func 委托。至少不适用于多个通用参数,例如:
System::Action<int, int>^ action = nullptr;
System::Func<int, int>^ func = nullptr;
两者都会导致错误,例如:
error C2977: 'System::Action' : too many generic arguments
error C2955: 'System::Action' : use of class generic requires generic argument list
只有单个参数 Action 有效:
System::Action<int>^ action = nullptr;
任何人都知道为什么或缺少什么来完成这项工作。我正在使用 Visual Studio 2008,该项目的目标框架为 3.5。
【问题讨论】:
-
你有对 System.Core 的引用吗?
标签: .net generics .net-3.5 delegates c++-cli